Skip to content

Commit

Permalink
TW-40 #comment Only remember user when there is a cookie AND it belon…
Browse files Browse the repository at this point in the history
…gs to the user.
  • Loading branch information
amparo-luna committed Mar 2, 2015
1 parent f967d22 commit 3065e3e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/authlogic_crowd/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,12 @@ def crowd_cookie_info
end

# As Authlogic creates a cookie to know if the user wants to be remembered
# returns true only if the cookie exists.
# returns true only if the cookie exists and it belongs to the logged in user.
# For cookie_key see Authlogic::Session::Cookies::Config
def should_remember_user?
controller && controller.cookies[cookie_key].present?
return false unless controller && controller.cookies[cookie_key].present?
credentials_from_cookie = controller.cookies[cookie_key].split("::")[1]
credentials_from_cookie == controller.session[cookie_key]
end

def refresh_user_token
Expand Down

0 comments on commit 3065e3e

Please sign in to comment.