typonaut
typonaut

Reputation: 321

django-allauth - show user email address in confirmation email

I am sending out user sign-up/confirmation emails (django_allauth), and customising the templates for this function. Everything is working, emails are sent out, correct templates are being used, users can click links and confirm addresses, etc.

However, I would like to be able to display the email address in the confirmation email, ie something like:

The {{ user_name }} wants to confirm the email address {{ email_address }}…

It seems to me to be obvious that django_allauth "knows" the email address, since it is handling the sending/confirmation, but there doesn't seem to be any documentation as to how to access that attribute.

Upvotes: 1

Views: 1802

Answers (1)

Eric Chen
Eric Chen

Reputation: 31

I was stuck with this issue for a LONG TIME, and there didn't seem to be any sources on the internet that could help me! But, it's actually really simple.

{{ user.email }} 

will get you the user email. The default implementation for getting the username is

{% user_display user %}

, but I'm guessing you can also use {{ user.username }}

https://django-allauth.readthedocs.io/en/latest/templates.html#account-tags explains some of it. Good luck!

Upvotes: 0

Related Questions