diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/elevations_controller.rb | 11 | ||||
| -rw-r--r-- | app/controllers/otp_challenges_controller.rb | 7 |
2 files changed, 17 insertions, 1 deletions
diff --git a/app/controllers/elevations_controller.rb b/app/controllers/elevations_controller.rb index 804b8f95..229f33d8 100644 --- a/app/controllers/elevations_controller.rb +++ b/app/controllers/elevations_controller.rb | |||
| @@ -41,4 +41,15 @@ class ElevationsController < ApplicationController | |||
| 41 | flash[:notice] = t("flash.elevation.dropped") | 41 | flash[:notice] = t("flash.elevation.dropped") |
| 42 | redirect_to admin_path | 42 | redirect_to admin_path |
| 43 | end | 43 | end |
| 44 | |||
| 45 | def renew | ||
| 46 | if renew_elevation! | ||
| 47 | flash[:notice] = t("flash.elevation.renewed", | ||
| 48 | :minutes => AuthenticatedSystem::ELEVATION_MAX_AGE.in_minutes.to_i, | ||
| 49 | :left => elevation_extensions_left) | ||
| 50 | else | ||
| 51 | flash[:error] = t("flash.elevation.cannot_renew") | ||
| 52 | end | ||
| 53 | redirect_back(:fallback_location => admin_path, :allow_other_host => false) | ||
| 54 | end | ||
| 44 | end | 55 | end |
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") |
