I’m building a user authentication app in django, and following this tutorial:
https://dev.to/earthcomfy/django-reset-password-3k0l
I’m able to successfully get to the password_reset.html
template, where I can enter an email address and submit.
If I enter an email that is not associated with a user, the success_message
from the ResetPasswordView
is triggered, but if I enter a valid email address, associated with a user, I get the error.
I did everything as per the tutorial, and I’ve verified that my email configs work by using EmailMessage
module from the django shell to send emails.
my ResetPasswordView
:
class ResetPasswordView(SuccessMessageMixin, PasswordResetView):
template_name = 'users/password_reset.html'
email_template_name = 'users/password_reset_email.html'
subject_template_name = 'users/password_reset_subject'
success_message = "We've emailed you instructions for setting your password, "
"if an account exists with the email you entered. You should receive them shortly."
" If you don't receive an email, "
"please make sure you've entered the address you registered with, and check your spam folder."
success_url = reverse_lazy('users-home')
I have all the templates in that class in the relevant places. The password_reset_subject
is a .txt file as per the tutorial.
Template-loader postmortem
Django tried loading these templates, in this order:
Using engine django:
django.template.loaders.app_directories.Loader: /Users/.../user_management/users/templates/users/password_reset_subject (Source does not exist)
but that is exactly where the password_reset_subject.txt file is. I thought maybe it should be .html but it should be a .txt according to the tutorial author.