UserModel -> User
This commit is contained in:
parent
ecee55b343
commit
0dfc8f6aea
2 changed files with 6 additions and 8 deletions
|
@ -3,7 +3,7 @@ from authens.backends import ENSCASBackend
|
|||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.backends import ModelBackend
|
||||
|
||||
UserModel = get_user_model()
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class CASBackend(ENSCASBackend):
|
||||
|
@ -16,9 +16,7 @@ class CASBackend(ENSCASBackend):
|
|||
email = attributes.get("email")
|
||||
name = attributes.get("name")
|
||||
|
||||
return UserModel.objects.create_user(
|
||||
username=username, email=email, full_name=name
|
||||
)
|
||||
return User.objects.create_user(username=username, email=email, full_name=name)
|
||||
|
||||
|
||||
class PwdBackend(ModelBackend):
|
||||
|
@ -45,10 +43,10 @@ class ElectionBackend(ModelBackend):
|
|||
return None
|
||||
|
||||
try:
|
||||
user = UserModel.objects.get(
|
||||
user = User.objects.get(
|
||||
username=f"{election_id}__{login}", election=election_id
|
||||
)
|
||||
except UserModel.DoesNotExist:
|
||||
except User.DoesNotExist:
|
||||
return None
|
||||
|
||||
if user.check_password(password):
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.contrib.auth import get_user_model
|
|||
from django.core.validators import validate_email
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
UserModel = get_user_model()
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class ElectionAuthForm(forms.Form):
|
||||
|
@ -80,5 +80,5 @@ class PwdUserForm(forms.ModelForm):
|
|||
return cleaned_data
|
||||
|
||||
class Meta:
|
||||
model = UserModel
|
||||
model = User
|
||||
fields = ["username", "full_name", "email"]
|
||||
|
|
Loading…
Reference in a new issue