summaryrefslogtreecommitdiff
path: root/users/app/controllers/controller_extension/token_authentication.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-08-27 14:55:43 +0200
committerAzul <azul@leap.se>2013-08-27 14:57:44 +0200
commit5e6a2a2995598489372676bf8e045dc2dfda6c81 (patch)
tree4b1d675191fededd08ad2329cb8b50e9eb74c92e /users/app/controllers/controller_extension/token_authentication.rb
parent147ccec989672f9b1314aa6dcc5ce8578e841370 (diff)
token.user will get you the right user
This way we can stub the token to return the user directly. Stubbing User.find_by_param is not a good idea as it will make all calls to User#find_by_param with a different id fail.
Diffstat (limited to 'users/app/controllers/controller_extension/token_authentication.rb')
-rw-r--r--users/app/controllers/controller_extension/token_authentication.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/users/app/controllers/controller_extension/token_authentication.rb b/users/app/controllers/controller_extension/token_authentication.rb
index 82df314..3e2816d 100644
--- a/users/app/controllers/controller_extension/token_authentication.rb
+++ b/users/app/controllers/controller_extension/token_authentication.rb
@@ -5,7 +5,7 @@ module ControllerExtension::TokenAuthentication
authenticate_with_http_token do |token_id, options|
@token = Token.find(token_id)
end
- User.find_by_param(@token.user_id) if @token
+ @token.user if @token
end
def logout