Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Warden::Manager.after_set_user except: :fetch do |user, warden, _|
- UserSession.deactivate(warden.raw_session['auth_id'])
- warden.raw_session['auth_id'] = user.activate_session(
- ip: warden.request.ip,
- user_agent: warden.request.user_agent
- )
- end
- # After fetching a user from the session, we check that the session is marked
- # as active for that user. If it’s not we log the user out.
- Warden::Manager.after_fetch do |user, warden, _|
- unless user.session_active?(warden.raw_session['auth_id'])
- warden.logout
- throw :warden, message: :unauthenticated
- end
- end
- def sign_in(resource, *opts)
- super(resource, *opts)
- warden.set_user(resource, {})
- end
Add Comment
Please, Sign In to add comment