tabletop-companion/app/controllers/application_controller.rb

15 lines
335 B
Ruby

class ApplicationController < ActionController::Base
before_action :authenticate
private
def authenticate
if authenticated_user = User.find_by(id: session[:user_id])
Current.user = authenticated_user
else
flash[:alert] = t("not_authenticated")
redirect_to login_path
end
end
end