diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-01 18:38:42 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-01 18:38:42 +0200 |
| commit | 45432cba9f524c99015c90b6b6aa381fe2b04984 (patch) | |
| tree | 35345a3efedeaa1bd63db09ff99ac23187c081e3 /lib/authenticated_system.rb | |
| parent | 4175f26cc8b22ff5a07929fa2436c561022cccd2 (diff) | |
Require a second factor for elevation, not for holding admin
Diffstat (limited to 'lib/authenticated_system.rb')
| -rw-r--r-- | lib/authenticated_system.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/authenticated_system.rb b/lib/authenticated_system.rb index 04d8051f..668436b5 100644 --- a/lib/authenticated_system.rb +++ b/lib/authenticated_system.rb | |||
| @@ -25,9 +25,10 @@ module AuthenticatedSystem | |||
| 25 | # Tied to is_admin? so losing the role closes the window at once, rather | 25 | # Tied to is_admin? so losing the role closes the window at once, rather |
| 26 | # than leaving a timestamp that would count again if the role returned. | 26 | # than leaving a timestamp that would count again if the role returned. |
| 27 | def elevated? | 27 | def elevated? |
| 28 | return false unless current_user&.is_admin? | 28 | return false unless current_user&.is_admin? |
| 29 | session[:elevated_at].to_i > ELEVATION_MAX_AGE.ago.to_i | 29 | return false unless current_user.otp_enrolled? |
| 30 | end | 30 | session[:elevated_at].to_i > ELEVATION_MAX_AGE.ago.to_i |
| 31 | end | ||
| 31 | 32 | ||
| 32 | def elevation_expires_at | 33 | def elevation_expires_at |
| 33 | return nil unless elevated? | 34 | return nil unless elevated? |
