diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-01 02:39:59 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-01 02:39:59 +0200 |
| commit | 6df48c1413a14516e7ee8919f33fbc13f0141966 (patch) | |
| tree | d81df761eb6607a6f4508241c043375e9860679d /app/controllers/otp_challenges_controller.rb | |
| parent | f6c1f0f08f031778a491465d35ac694bfcdc12b0 (diff) | |
Show and extend the elevation window
A banner appears while elevated, counting down in minutes and carrying
extend and drop controls. Three extensions of 30 minutes are allowed, so
the window is at most two hours without a fresh code; a code resets the
budget. The countdown is advisory, the server-side check authoritative, so
it says "expired" rather than vanishing.
The post-login flash tells an admin the timer has started.
Diffstat (limited to 'app/controllers/otp_challenges_controller.rb')
| -rw-r--r-- | app/controllers/otp_challenges_controller.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/otp_challenges_controller.rb b/app/controllers/otp_challenges_controller.rb index 87586241..2526d1fb 100644 --- a/app/controllers/otp_challenges_controller.rb +++ b/app/controllers/otp_challenges_controller.rb | |||
| @@ -31,7 +31,12 @@ class OtpChallengesController < ApplicationController | |||
| 31 | # an admin who logs in and goes straight to user management | 31 | # an admin who logs in and goes straight to user management |
| 32 | # is already elevated | 32 | # is already elevated |
| 33 | elevate! if user.is_admin? | 33 | elevate! if user.is_admin? |
| 34 | flash[:notice] = t("flash.common.logged_in") | 34 | flash[:notice] = if user.is_admin? |
| 35 | t("flash.elevation.granted_at_login", | ||
| 36 | :minutes => AuthenticatedSystem::ELEVATION_MAX_AGE.in_minutes.to_i) | ||
| 37 | else | ||
| 38 | t("flash.common.logged_in") | ||
| 39 | end | ||
| 35 | redirect_to safe_return_to(return_to, :default => admin_path) | 40 | redirect_to safe_return_to(return_to, :default => admin_path) |
| 36 | else | 41 | else |
| 37 | flash.now[:error] = t("flash.otp.code_mismatch") | 42 | flash.now[:error] = t("flash.otp.code_mismatch") |
