summaryrefslogtreecommitdiff
path: root/app/controllers/elevations_controller.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-08-01 02:39:59 +0200
committererdgeist <erdgeist@erdgeist.org>2026-08-01 02:39:59 +0200
commit6df48c1413a14516e7ee8919f33fbc13f0141966 (patch)
treed81df761eb6607a6f4508241c043375e9860679d /app/controllers/elevations_controller.rb
parentf6c1f0f08f031778a491465d35ac694bfcdc12b0 (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/elevations_controller.rb')
-rw-r--r--app/controllers/elevations_controller.rb11
1 files changed, 11 insertions, 0 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
44end 55end