fix: send reset emails

At the moment, the email is stored in the `username` field.

Django form-handling looks for the default email
field [0] to find the user email.

If it doesnet find anything, it fails silently
(to avoid leaking information about the users
present in the system, which is a good thing)

The fix was to change the field used to check for the email.

[0] eea4f92f9a/django/contrib/auth/forms.py (L326-L337)
This commit is contained in:
Alexis Métaireau 2023-12-17 03:18:20 +01:00 committed by Alexis Metaireau
parent 7ff388331a
commit e8d99ea74c

View file

@ -3,6 +3,8 @@ from django.db import models
class CustomUser(AbstractUser): class CustomUser(AbstractUser):
EMAIL_FIELD = "username"
username = models.EmailField( username = models.EmailField(
"Email", "Email",
unique=True, unique=True,