authentication - How to use friend with compojure? -
i'm new clojure, , i'm trying add authentication system compujure app , i'm using cemerick.friend.
all routes working fine, i'm never able login, when using dummy in memory database (if can call that).
the problem, believe, on cemerick.friend.credentials/bcrypt-credential-fn
, never validating credentials.
here's gist relevant code: https://gist.github.com/zamith/5940965
any on how solve problem nice.
thanks.
you want use workflows/interactive-form
specify workflows/interactive-login-redirect
.
the latter function's purpose serve default :login-failure-handler
. perform redirect after failed login attempt; makes no attempt log user in.
you need remove (resp/redirect "/signup")
body of friend/authenticated
form in "/dashboard"
route, it's unconditionally redirecting logged in users signup page. (that redirect happens in fact proof of user being authenticated, since otherwise body of friend/authenticated
not evaluated , there's nothing else in code cause redirect "/signup"
.)
with these 2 changes, app works me.
Comments
Post a Comment