How do I access user authentication from the hamlet template?

For example, if no one is registered, I want to show them links to where they can register or log in, but if the user is logged in, I want them to allow them to access their profile and other information.

+3


source to share


1 answer


You need to use maybeAuth

from Haskell code to get authentication information and then $maybe

inside Hamlet to change behavior based on that result. You cannot do maybeAuth

from within Hamlet, since Hamlet does not allow you to do anything (like searching the database).



+3


source







All Articles