summaryrefslogtreecommitdiff
path: root/app/controllers/sessions_controller.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-24 17:20:41 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-24 17:20:41 +0200
commitd5883869e97244335370d54e21ef46b3f1885899 (patch)
tree4575a24150f4c2fa98de54fdd556132f0aa0ff8c /app/controllers/sessions_controller.rb
parent0d2a8e4b61f4b79507519c73f127b7ab883d853c (diff)
Give all sessions a uniform absolute lifetime of one week
Enforced at restore via a login-time stamp, written only at genuine logins so the limit stays absolute rather than sliding. The cookie name rotation logs everyone out once at deploy. Second-factor users are deliberately not treated worse than password-only ones.
Diffstat (limited to 'app/controllers/sessions_controller.rb')
-rw-r--r--app/controllers/sessions_controller.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index f0d5cf9b..49d33810 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -29,6 +29,8 @@ class SessionsController < ApplicationController
29 redirect_to new_otp_challenge_path 29 redirect_to new_otp_challenge_path
30 else 30 else
31 self.current_user = user 31 self.current_user = user
32 session[:logged_in_at] = Time.now.to_i
33
32 if user.otp_required? 34 if user.otp_required?
33 flash[:error] = "Your account requires a second factor -- set it up now." 35 flash[:error] = "Your account requires a second factor -- set it up now."
34 redirect_to edit_user_path(user) 36 redirect_to edit_user_path(user)