Fork me on GitHub
#biff
<
2022-08-25
>
Richard Bowen07:08:43

Hey, how would you do traditional auth with biff?

Jacob O'Bryant14:08:12

like password auth? at the moment you'd have to implement it yourself, though I am actually planning to add it to biff hopefully soon. if you wanted to take a crack at implementing it, I'd first familiarize yourself with the code in auth.clj. then you can add two more post endpoints, one for signup and one for signin. see https://luminusweb.com/docs/security.html for a quick example of hashing and verifying a password. on signup you'll take the password's hash and store it on the user document, and on signin you'll take a new hash and verify it against the stored hash.

👍 1
Soe H11:08:45

Hi, excuse me for a very beginner question. But how to do file upload with biff?

Jacob O'Bryant14:08:32

no problem! on the client side you can use a regular <input type="file" ... element. put it inside a form that does a POST request. on the server side, set up a POST handler function to receive the form. then check the :params key in the request. there will be a tempfile that you can read from or copy (see ).

thanks3 1
Jacob O'Bryant17:08:40

Yep, same thing pretty much.