From e8d99ea74c1f8c2d943cb4c340f662385e0fe720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Sun, 17 Dec 2023 03:18:20 +0100 Subject: [PATCH] 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] https://github.com/django/django/blob/eea4f92f9aa57d1b25f1c28d11c3b5a6a5841e82/django/contrib/auth/forms.py#L326-L337 --- la_chariotte/accounts/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/la_chariotte/accounts/models.py b/la_chariotte/accounts/models.py index fee40a8..a953c3b 100644 --- a/la_chariotte/accounts/models.py +++ b/la_chariotte/accounts/models.py @@ -3,6 +3,8 @@ from django.db import models class CustomUser(AbstractUser): + EMAIL_FIELD = "username" + username = models.EmailField( "Email", unique=True,