From b82403e0e19474427bc8c44cff6d6f21e9735c34 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Sat, 28 Mar 2020 14:02:51 -0500 Subject: [PATCH] Parse the session time so we can calculate expire time. --- app/controllers/login_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/login_controller.rb b/app/controllers/login_controller.rb index 4331c550..7dda303f 100644 --- a/app/controllers/login_controller.rb +++ b/app/controllers/login_controller.rb @@ -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