Skip to content
Discussion options

You must be logged in to vote

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:

constraints -> (r) { r.env["rodauth"].require_account; r.env["rodauth"].authenticated? } do
  # ...
end

In the next release, I plan to add a new Rodauth::Rails.authenticate constraint that calls rodauth.require_account and deprecate Rodauth::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's authenticated behaves).

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@Halvanhelv
Comment options

@janko
Comment options

janko Aug 3, 2023
Maintainer

@Halvanhelv
Comment options

@janko
Comment options

janko Aug 3, 2023
Maintainer

Answer selected by Halvanhelv
@Halvanhelv
Comment options

@Halvanhelv
Comment options

@Halvanhelv
Comment options

@janko
Comment options

janko Aug 4, 2023
Maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants