Hello. In my project, I inherit the PasswordResetForm and PasswordResetView to add some custom functionality, which allows a user to enter their username or email, and receive an email to that users account.
Displayed here (should a queryset of matching users):
forms file class MyPasswordResetForm(PasswordResetForm): email = forms.CharField(min_length=2) # Method on PasswordResetForm found at GitHub link below (Should return queryset of users) def get_users(self, email): try: user = User.objects.filter(username=email) return user except User.DoesNotExist: try: user = User.objects.filter(email=email) return user except User.DoesNotExist: return None view: # Override property of PasswordResetView to work with my custom form class MyPasswordResetView(PasswordResetView): form_class = MyPasswordResetForm
I then expect an email to be sent to the user, however it isn’t. I don’t receive any error from the console, even when using:
EMAIL_BACKEND = ‘django.core.mail.backends.console.EmailBackend’
The email is being sent using EmailMultiAlternatives, therefore I cannot set fail_silently to false. The function that sends the email is named send_mail, and is found in the PasswordResetForm on this page: https://github.com/django/django/blob/94f63b926fd32d7a7b6e2591ef72aa8f040f25cc/django/contrib/auth/forms.py#L251
I have all the email requirements setup in the settings file, and I have also allowed less secure apps option in my gmail account.
These are all the properties I set in the settings file. Does anybody have any idea what is failing here? Thanks.