Nikos
Nikos

Reputation: 437

How to override the email being sent for the user email verification step in django-rest-auth so that it's more mobile app apropriate

I am working on a django rest application which is aimed to be consumed through a mobile application.

We are currently using dj-rest-auth for handling the authentication process but I have a problem with the email verification part.

The default email that is being sent is something like:

please follow this url to verify your account.

But since the client for us is a mobile application what we want to have is something like:

Please use this token with the application to verify your email.

The problem is that the email is sending to the user a url to follow, The url itself contains the necessary token which is needed for the rest call to verify the user and although I can override the email being send though providing a different email_confirmation_message.txt but I can't seem to get just the token because I the only variable the is pre-configured there for me is the one called active_url.

Do you have any suggestion on how to go with this or any direction would be useful.

Upvotes: 0

Views: 1132

Answers (2)

Daniel RB
Daniel RB

Reputation: 21

django-rest-auth uses django allauth under the hood so you can override any of the default allauth templates. For the email templates see documentation

For the verification email you will have to override account/email/email_confirmation_message.txt

Upvotes: 1

Nikos
Nikos

Reputation: 437

After some research I dig into the code of dj-rest-auth and found out that The VerifyEmailSerializer has one field which instead of what I though is called key = serializers.CharField() so you can use the {{key}} variable within the email to get the hexadecimal coded needed!

Upvotes: 0

Related Questions