Fork me on GitHub
#liberator
<
2020-06-07
>
adam03:06:39

Hi all. I am wondering if Liberator handles HTML login forms or it's just for APIs. I am particularly confused about what to do after using post! , what if: 1. The provided credentials are correct, how can I redirect the user to, say, my dashboard? 2. The provided credentials are invalid, how can show my :handle-ok contents back with some error message?

ordnungswidrig20:06:13

@somedude314 if the credentials are incorrect (which you would check in :authorized? ) then :handle-not-authorized kicks in (returning status 401). There you can also return your message.

ordnungswidrig20:06:13

You should also set :post-redirect? to true and set the :location in the context to the target URL.

adam20:06:16

Thanks, will try the above after installing the middleware you mentioned on #clojure