summaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to 'users')
-rw-r--r--users/app/controllers/controller_extension/token_authentication.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/users/app/controllers/controller_extension/token_authentication.rb b/users/app/controllers/controller_extension/token_authentication.rb
index 530294a..cd5c074 100644
--- a/users/app/controllers/controller_extension/token_authentication.rb
+++ b/users/app/controllers/controller_extension/token_authentication.rb
@@ -1,11 +1,14 @@
module ControllerExtension::TokenAuthentication
extend ActiveSupport::Concern
- def token_authenticate
- authenticate_with_http_token do |token_id, options|
- @token = Token.find(token_id)
+ def token
+ @token ||= authenticate_with_http_token do |token_id, options|
+ Token.find(token_id)
end
- @token.authenticate if @token
+ end
+
+ def token_authenticate
+ token.authenticate if token
end
def logout
@@ -14,10 +17,7 @@ module ControllerExtension::TokenAuthentication
end
def clear_token
- authenticate_with_http_token do |token_id, options|
- @token = Token.find(token_id)
- @token.destroy if @token
- end
+ token.destroy if token
end
end