tabletop-companion/app/controllers/application_controller.rb

17 lines
366 B
Ruby
Raw Normal View History

2024-05-26 10:45:10 +00:00
# frozen_string_literal: true
2024-04-13 10:22:40 +00:00
class ApplicationController < ActionController::Base
2024-04-21 14:01:10 +00:00
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
2024-04-13 10:22:40 +00:00
end