mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Add a bit more logging
This commit is contained in:
parent
742be59ffe
commit
af2d812a2e
@ -1,3 +1,4 @@
|
||||
import logging
|
||||
from urllib.parse import quote
|
||||
|
||||
from allauth.account.adapter import DefaultAccountAdapter
|
||||
@ -9,6 +10,8 @@ from django.contrib.auth.models import User
|
||||
from django.forms import ValidationError
|
||||
from django.urls import reverse
|
||||
|
||||
logger = logging.getLogger("paperless.auth")
|
||||
|
||||
|
||||
class CustomAccountAdapter(DefaultAccountAdapter):
|
||||
def is_open_for_signup(self, request):
|
||||
@ -72,6 +75,7 @@ class CustomAccountAdapter(DefaultAccountAdapter):
|
||||
group_names: list[str] = settings.ACCOUNT_DEFAULT_GROUPS
|
||||
if len(group_names) > 0:
|
||||
groups = Group.objects.filter(name__in=group_names)
|
||||
logger.debug(f"Adding default groups to user `{user}`: {group_names}")
|
||||
user.groups.add(*groups)
|
||||
user.save()
|
||||
return user
|
||||
@ -105,6 +109,9 @@ class CustomSocialAccountAdapter(DefaultSocialAccountAdapter):
|
||||
group_names: list[str] = settings.SOCIAL_ACCOUNT_DEFAULT_GROUPS
|
||||
if len(group_names) > 0:
|
||||
groups = Group.objects.filter(name__in=group_names)
|
||||
logger.debug(
|
||||
f"Adding default social groups to user `{user}`: {group_names}",
|
||||
)
|
||||
user.groups.add(*groups)
|
||||
user.save()
|
||||
return user
|
||||
|
Loading…
x
Reference in New Issue
Block a user