entrance-exam/app/controllers/application_controller.rb

16 lines
424 B
Ruby

class ApplicationController < ActionController::Base
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
allow_browser versions: :modern
before_action :require_authorization
def authorized?
cookies.signed[:_entrance_exam_authorized].present?
end
private
def require_authorization
redirect_to new_sessions_path unless authorized?
end
end