Rodauth::Rails.authenticated does not protect the page in some cases #221
-
Hi! @janko I am still actively implementing rodauth-rails and am happy with it but a question has arisen I have encountered a situation where I am using That said, if I navigated to an unsecured page and then tried to log back into the secured page, After examining the source code of To solve this problem, I plugged in the Maybe I am missing some important aspects? Could you please help me to understand this situation? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
The As for # app/misc/rodauth_app.rb
class RodauthApp < Rodauth::Rails::App
route do |r|
rodauth.check_active_session
r.rodauth
end
end |
Beta Was this translation helpful? Give feedback.
Ah, yes, my tired brain thought
unless account_from_session ... end
will return the value of the condition if truthy 🤦🏻♂️ Then you'll need multiple statements:In the next release, I plan to add a new
Rodauth::Rails.authenticate
constraint that callsrodauth.require_account
and deprecateRodauth::Rails.authenticated
. The former name is IMO better anyway, because it communicates that it will require authentication, while the latter sounds like it will only check whether the user is authenticated, otherwise it will not route the request (like Devise'sauthenticated
behaves).