summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/token_authenticatable.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/app/models/concerns/token_authenticatable.rb b/app/models/concerns/token_authenticatable.rb
index 488ff8c31b7..e84c5804cf4 100644
--- a/app/models/concerns/token_authenticatable.rb
+++ b/app/models/concerns/token_authenticatable.rb
@@ -17,12 +17,8 @@ module TokenAuthenticatable
end
define_method("ensure_#{token_field}") do
- current_token = read_attribute(token_field)
- if current_token.blank?
- write_attribute(token_field, generate_token_for(token_field))
- else
- current_token
- end
+ send("reset_#{token_field}!") if read_attribute(token_field).blank?
+ read_attribute(token_field)
end
define_method("reset_#{token_field}!") do