Installed authentication-zero
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run

This commit is contained in:
2024-08-17 21:18:23 +02:00
parent cbe55aee36
commit c4b96a43e4
44 changed files with 988 additions and 10 deletions

View File

@@ -1,4 +1,18 @@
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 :set_current_request_details
before_action :authenticate
private
def authenticate
if session_record = Session.find_by_id(cookies.signed[:session_token])
Current.session = session_record
else
redirect_to sign_in_path
end
end
def set_current_request_details
Current.user_agent = request.user_agent
Current.ip_address = request.ip
end
end