mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
refactor: Traduction en anglais des modules "GestionInscription" et
"GestionLogin"
This commit is contained in:
20
Back-End/Auth/backends.py
Normal file
20
Back-End/Auth/backends.py
Normal file
@ -0,0 +1,20 @@
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.backends import ModelBackend
|
||||
from Auth.models import Profile
|
||||
from N3wtSchool import bdd
|
||||
|
||||
class EmailBackend(ModelBackend):
|
||||
def authenticate(self, request, username=None, password=None, **kwargs):
|
||||
|
||||
if username is None:
|
||||
username = kwargs.get(Profile.USERNAME_FIELD)
|
||||
|
||||
try:
|
||||
user = Profile.objects.get(email=username)
|
||||
|
||||
# Vérifie le mot de passe de l'utilisateur
|
||||
if user.check_password(password):
|
||||
return user
|
||||
except Profile.DoesNotExist:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user