Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 387
Ooto Avatar asked Jan 26 '23 11:01

Ooto


1 Answers

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.

like image 72
dirkgroten Avatar answered Jan 31 '23 08:01

dirkgroten