summaryrefslogtreecommitdiff
path: root/users/app/controllers
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-08-27 14:36:27 +0200
committerAzul <azul@leap.se>2013-08-27 14:57:44 +0200
commit420bfb326f974eec14b04d6a170ed2d28c14180f (patch)
tree98c34aef55d87dbf3cbce3569d6d85f3c52a9e48 /users/app/controllers
parente60ee749cab0f80cf23ca57e28c7de6d1b3a395b (diff)
clear token on logout with test
Diffstat (limited to 'users/app/controllers')
-rw-r--r--users/app/controllers/controller_extension/token_authentication.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/users/app/controllers/controller_extension/token_authentication.rb b/users/app/controllers/controller_extension/token_authentication.rb
index 06e9e04..e1c92e7 100644
--- a/users/app/controllers/controller_extension/token_authentication.rb
+++ b/users/app/controllers/controller_extension/token_authentication.rb
@@ -7,5 +7,17 @@ module ControllerExtension::TokenAuthentication
end
User.find_by_param(@token.user_id) if @token
end
+
+ def logout
+ super
+ clear_token
+ end
+
+ def clear_token
+ authenticate_with_http_token do |token_id, options|
+ @token = Token.find(token_id)
+ @token.destroy if @token
+ end
+ end
end