Sha256: 9fceb094c39a92ba904be5630ab91a678ddcb9f494a28edd1ea56c8c072991a1
Contents?: true
Size: 875 Bytes
Versions: 9
Compression:
Stored size: 875 Bytes
Contents
# Each time a record is set we check whether its session has already timed out # or not, based on last request time. If so, the record is logged out and # redirected to the sign in page. Also, each time the request comes and the # record is set, we set the last request time inside its scoped session to # verify timeout in the following request. Warden::Manager.after_set_user do |record, warden, options| scope = options[:scope] if record && record.respond_to?(:timedout?) && warden.authenticated?(scope) && options[:store] != false last_request_at = warden.session(scope)['last_request_at'] if record.timedout?(last_request_at) warden.logout(scope) throw :warden, :scope => scope, :message => :timeout end unless warden.request.env['devise.skip_trackable'] warden.session(scope)['last_request_at'] = Time.now.utc end end end
Version data entries
9 entries across 9 versions & 2 rubygems