Hi folks,
Beginner with elixir & AshAuthentication, trying to extend our app with functionality to email a new user with a link for them to confirm their ownership of the email address, and block them from signing in before their email address is confirmed. Seems like we need two routes:
-
Sends un-confirmed users to a dummy page directing them to confirm their email address via the email (potentially also including an input field for them to enter their email address so they can be re-sent the confirmation email)
-
Handles inbound confirmation email link clicks.
We have a sender working to send the email to the user upon registration with embedded URI in the form app/auth/user/confirm/<token>
.
Also able to manually complete confirmation with the following (per docs) so that the confirmed_at
field in the database is populated with a datetime.
strategy = AshAuthentication.Info.strategy!(MyApp.Accounts.User, :confirm)
{:ok, user} = AshAuthentication.Strategy.action(strategy, :confirm, %{"confirm" => “<token>”})
Next step seems to be to create the routes above, unless there are some in-built endpoints that we’re missing?
Anyone able to provide guidance would be greatly appreciated.
Adam