Parse the session time so we can calculate expire time.

This commit is contained in:
Matt Rogers 2020-03-28 14:02:51 -05:00
parent a9c741dfda
commit b82403e0e1
No known key found for this signature in database
GPG key ID: 6BAA7911427E1F68

View file

@ -40,7 +40,6 @@ class LoginController < ApplicationController
if session
return unless should_expire_sessions?
# Get expiry time (allow ten seconds window for the case where we have none)
expiry_time = session['expiry_time'] || Time.now + 10
time_left = expiry_time - Time.now
@session_expired = ( time_left < (10*60) ) # Session will time out before the next check
end
@ -76,4 +75,9 @@ class LoginController < ApplicationController
session['noexpiry'] != "on"
end
def expiry_time
return Time.now + 10 unless session['expiry_time']
DateTime.strptime(session['expiry_time'], "%FT%T%Z")
end
end