Spaces:
Sleeping
Sleeping
File size: 704 Bytes
397e650 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | class ApplicationController < ActionController::Base
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
allow_browser versions: :modern
# Changes to the importmap will invalidate the etag for HTML responses
stale_when_importmap_changes
# Active Admin authentication
def authenticate_admin!
authenticate_or_request_with_http_basic("Active Admin") do |username, password|
user = User.find_by(username: username)
if user&.authenticate(password) && user.admin?
@current_admin_user = user
true
else
false
end
end
end
def current_admin_user
@current_admin_user
end
end
|