diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-24 17:20:41 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-24 17:20:41 +0200 |
| commit | d5883869e97244335370d54e21ef46b3f1885899 (patch) | |
| tree | 4575a24150f4c2fa98de54fdd556132f0aa0ff8c /lib/authenticated_test_helper.rb | |
| parent | 0d2a8e4b61f4b79507519c73f127b7ab883d853c (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 'lib/authenticated_test_helper.rb')
| -rw-r--r-- | lib/authenticated_test_helper.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/authenticated_test_helper.rb b/lib/authenticated_test_helper.rb index c0ec5f40..8f3a3732 100644 --- a/lib/authenticated_test_helper.rb +++ b/lib/authenticated_test_helper.rb | |||
| @@ -2,5 +2,6 @@ module AuthenticatedTestHelper | |||
| 2 | # Sets the current user in the session from the user fixtures. | 2 | # Sets the current user in the session from the user fixtures. |
| 3 | def login_as(user) | 3 | def login_as(user) |
| 4 | @request.session[:user_id] = user ? users(user).id : nil | 4 | @request.session[:user_id] = user ? users(user).id : nil |
| 5 | end | 5 | @request.session[:logged_in_at] = Time.now.to_i |
| 6 | end | ||
| 6 | end | 7 | end |
