Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Handling Password Reset Emails

00:00 Handling Password Reset Emails. As seen previously, each password reset email sent by Django contains a link that can be used to reset the password. To handle that link correctly, Django needs two more templates: password_reset_confirm to display the actual password reset form and password_reset_complete to show a confirmation that a password was reset.

00:28 These will look very similar to the password change templates. Let’s start with the form.

00:54 Just like before, Django will automatically provide a form, but this time it will be a password reset form. You’ll also need a confirmation template.

01:34 If you now follow the password reset link from one of the emails, you should see a form similar to the one seen on-screen. You can now check if it works. Insert a new password into the form, click Confirm, log out, and log in using that new password.

01:51 You can change the default templates for Django emails just like any other user management related templates. password_reset_email determines the body of the email, and password_reset_subject determines the subject of the email.

02:08 Django provides a wide range of variables in the email template context that you can use to compose your own messages.

02:44 You can also change the subject to something more descriptive by altering the file seen on-screen. If you implement these changes and send a password reset email again, then you should see this reflected in a terminal showing the email content.

03:08 As you can see, both the subject and content of the email have changed. Now that you have the features set up to allow users to manage their own passwords, in the next section, you’ll take a look at how to set your site up to allow users to register.

kevinponcepk on July 23, 2022

Hey please. My problem are the ‘Subject:’ of my email is ” Password reset on”.

I try many think but I don’t…

Sorry for my English man I’m French people and my English are so bad.

But I want to work hard for upgrade this languague skills.


Bartosz Zaczyński RP Team on July 25, 2022

@kevinponcepk Can you give us more details, please? Perhaps you could share your code via a link to your GitHub repository or GitHub gist?

stehnacheric on Nov. 18, 2022

Hello, I am having a weird issue with the password reset form. I am able to add the password reset link, have it send to my terminal and get to the link but the actual form seems broken. The issue is that I can only type into the confirm email field and the new password field has no input. I have a screen shot if that helps I can add it to the slack channel if you need more info.

Thanks, Eric

Become a Member to join the conversation.