mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-21 21:40:48 +02:00
Merge pull request #2366 from TracksApp/fix-expiry-check
Parse the session time so we can calculate expire time.
This commit is contained in:
commit
772b68b0c2
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue