riverrun / openmaize

No longer maintained - was an Authentication library for Plug-based applications in Elixir
Other
206 stars 30 forks source link

Newbie question: How would you proceed on verifying the confirmation link? #78

Closed ghost closed 7 years ago

ghost commented 7 years ago

As the title says, I'm quite a newbie in Phoenix / Elixir. How would you proceed on creating the functionality which verifies the confirmation link that is sent by ask_confirm? I am not looking for a full-fledged tutorial, but a small top-level explanation.

I imagine you could have a function which is associated with a route that is supposed to receive the link and then add the current date to :confirmed_at? Would it be a good idea to add a confirmed boolean to the User schema and then switch the boolean to true when the user accesses the link sent in the email?

Thanks in advance!

riverrun commented 7 years ago

Sorry about the delay in getting back to you.

There's an example of how to handle confirmation here, but it might be helpful to give you some idea of the workflow:

Each subsequent login then checks the user's confirmed_at value. If it is nil, the login fails. There's no need for an additional confirmed boolean value in the schema.