Files
MySMSAPio/app/controllers/admin/base_controller.rb
2026-07-28 03:04:27 +08:00

22 lines
509 B
Ruby

module Admin
class BaseController < ActionController::Base
include Pagy::Backend
include AdminAuthentication
# Enable session and flash for admin controllers
# (needed because the app is in API-only mode)
protect_from_forgery with: :exception
layout "admin"
before_action :require_admin
helper_method :current_admin, :logged_in?
private
def require_admin
redirect_to admin_login_path, alert: "Please log in to continue" unless logged_in?
end
end
end