remove more email related code
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 8s
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 8s
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.backends import ModelBackend
|
||||
|
||||
|
||||
class EmailBackend(ModelBackend):
|
||||
def authenticate(self, request, username=None, password=None, **kwargs):
|
||||
UserModel = get_user_model()
|
||||
if not password:
|
||||
return None
|
||||
try:
|
||||
user = UserModel.objects.get(email=username)
|
||||
except UserModel.DoesNotExist:
|
||||
return None
|
||||
else:
|
||||
if user.check_password(password):
|
||||
return user
|
||||
return None
|
||||
@@ -75,6 +75,10 @@ class User(AbstractUser):
|
||||
|
||||
objects = CustomUserManager()
|
||||
|
||||
# Log in with username + password only; email is optional and not prompted
|
||||
# by createsuperuser.
|
||||
REQUIRED_FIELDS = []
|
||||
|
||||
|
||||
class TemporaryUser(models.Model):
|
||||
t_id = models.AutoField(primary_key=True)
|
||||
|
||||
+2
-2
@@ -157,9 +157,9 @@ DATABASES = {
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
|
||||
|
||||
# Uses email as username for login
|
||||
# Log in with username + password (default Django backend)
|
||||
AUTH_USER_MODEL = "api.User"
|
||||
AUTHENTICATION_BACKENDS = ["api.backends.EmailBackend"]
|
||||
AUTHENTICATION_BACKENDS = ["django.contrib.auth.backends.ModelBackend"]
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user