Search code examples
djangodjango-rest-frameworksingle-page-applicationdjango-allauthdjango-rest-auth

Django all auth: How to override the confirmation email url


What I want to do is to override confirmation email url in templates/account/email/email_confirmation_message.txt.

I want to change this part

To confirm this is correct, go to {{ activate_url }}

to something like

http://localhost:8080/confirm_email/{{ key }}

However, I couldn't figure out where {{ activate_url }} comes from. I want to send the key to the endpoint made by rest-auth.

How can I rewrite the url link on email? Or if it's too complitcated, what is the easy way to verify the email on frontend?


Solution

  • The template is rendered with a context containing user, current_site, activate_url and key (see the send_confirmation_mail() method in allauth/account/adapter.py).

    So you can just override the template and use key (and probably also current_site to make an absolute URI) to create your URL in the template.