tabletop-companion/app/controllers/application_controller.rb

17 lines
366 B
Ruby

# frozen_string_literal: true
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