django_microsoft_auth icon indicating copy to clipboard operation
django_microsoft_auth copied to clipboard

Create user with is_staff=True

Open yunikka opened this issue 4 years ago • 3 comments

Hello!

After the first login, the user logs into the admin. That is, the user is created with is_staff=True. It would have been very comfortable.

yunikka avatar Oct 24 '19 08:10 yunikka

this is actually a solution that I did here - similar to what you asking

from django.db.models.signals import post_save, m2m_changed, post_delete
from django.dispatch import receiver
@receiver(post_save, sender=User)
def add_to_default_group(sender, **kwargs):
    user = kwargs["instance"]
    if kwargs["created"]:
        user.is_staff = True
        user.save()

nabazm avatar Apr 16 '20 18:04 nabazm

@nabazm where we have to change, means which file we have to add the above code

Also, this package Authenticates only for Admin Login, how can we add this for our views,

Sunag3 avatar Jan 16 '21 17:01 Sunag3

@Sunag3 Please did you find a way to add it to the views? If so help!!

Priscilla-Odame avatar Jun 14 '21 14:06 Priscilla-Odame