First
CI / scan_ruby (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
2026-04-29 00:06:36 +01:00
commit 6f64e1a530
97 changed files with 3179 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
class AdminsController < ApplicationController
PASSWORD_PARTS = %w[GEAR AXLE TURBO PARK].freeze
def show
@unlocked = admin_unlocked?
end
def create
if submitted_password == admin_password
session[:admin_unlocked] = true
redirect_to admin_path, notice: "Admin Panel Unlocked"
else
session[:admin_unlocked] = false
@unlocked = false
flash.now[:alert] = "That passphrase did not unlock anything. Check the advert again."
render :show, status: :unprocessable_entity
end
end
def destroy
session.delete(:admin_unlocked)
redirect_to admin_path, notice: "Admin session cleared."
end
private
def admin_password
PASSWORD_PARTS.join("-")
end
def admin_unlocked?
session[:admin_unlocked] == true
end
def submitted_password
params.fetch(:password, "").upcase.gsub(/\s+/, "")
end
end