Search code examples
djangodjango-rest-auth

How to customize django rest auth password reset email content/template


In django rest_auth password reset, default email content look like following:-

You're receiving this email because you requested a password reset for your user account at localhost:8000.

Please go to the following page and choose a new password:

http://localhost:8000/api/reset/Kih/89a-23809182347689312b123/

Your username, in case you've forgotten: test

Thanks for using our site!

The localhost:8000 team

How to customize content of this email ?


Solution

  • You need to hook up your own reset password serializer (PASSWORD_RESET_SERIALIZER) with customized save method.

    (ref: https://github.com/Tivix/django-rest-auth/blob/v0.6.0/rest_auth/serializers.py#L123)

    Unfortunately you need to override the whole save method, due to how the e-mail options are used. We we'll make it a bit more flexible in the next release (0.7.0)