You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.
My django application contains a custom user model where email replaces the username authentication. Therefore, username removed in the User. As a result, it is not feasible to use the django_microsoft_auth package. Kindly help me out.
adding username might not be a good option for my application.
an example user model implementation is attached below
from django.db import models
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin
from django.utils.translation import gettext_lazy as _
from django.utils import timezone
from .managers import CustomUserManager
class CustomUser(AbstractBaseUser, PermissionsMixin):
email = models.EmailField(_('email address'), unique=True)
is_staff = models.BooleanField(default=False)
is_active = models.BooleanField(default=True)
date_joined = models.DateTimeField(default=timezone.now)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
objects = CustomUserManager()
def __str__(self):
return 'self.email'
The text was updated successfully, but these errors were encountered:
Username is hardcoded for user creation at the moment, so the package requires an AbstractUser, not an AbstractBaseUser. It is only used for user creation though, nothing afterwards so it should be easy to remove the requirement. It was not a requirement in my original creation of the package and one else as added it.
If you would like to make a PR for improvement to allow the backend to work better with user models created with AbstractBaseUser, feel free to make a PR.
AngellusMortis
changed the title
How feasible to use django_microsoft_auth for custom user model
Authentication backend does not work with AbstractBaseUser custom user models
Jan 14, 2021
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
My django application contains a custom user model where email replaces the username authentication. Therefore, username removed in the User. As a result, it is not feasible to use the django_microsoft_auth package. Kindly help me out.
The text was updated successfully, but these errors were encountered: