Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def authenticate
- login_success = authenticate_or_request_with_http_basic do |username, password|
- actual_password = ENV['ADMIN_PASSWORD'] || "secret"
- username == "admin" && password == actual_password
- end
- session[:admin] = "admin" if login_success == true
- end
- helper_method :admin?
- def admin?
- session[:admin] || false
- end
Add Comment
Please, Sign In to add comment