Check authentication on each request (#26)

Reviewed-on: #26
This commit is contained in:
Andrew Tomaka 2024-08-16 19:59:29 -04:00
parent 96ca8b7e7c
commit 452be0c49c
10 changed files with 59 additions and 10 deletions

View file

@ -1,2 +1,3 @@
class ApplicationController < ActionController::Base
include Authenticatable
end

View file

@ -0,0 +1,13 @@
module Authenticatable
extend ActiveSupport::Concern
included do
before_action :authenticate_user
end
private
def authenticate_user
Current.user = User.find_by(id: session[:current_user_id]) || GuestUser.new
end
end