mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-01 19:32:26 +02:00
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)
17 lines
406 B
Python
17 lines
406 B
Python
from django.contrib.auth.models import AbstractUser
|
|
from django.db import models
|
|
|
|
|
|
class CustomUser(AbstractUser):
|
|
EMAIL_FIELD = "username"
|
|
|
|
username = models.EmailField(
|
|
"Email",
|
|
unique=True,
|
|
error_messages={
|
|
"unique": "Un·e utilisateur·ice avec cette adresse mail existe déjà.",
|
|
},
|
|
)
|
|
|
|
def __str__(self):
|
|
return self.get_full_name()
|