Skip to content

Commit

Permalink
#354 Create AccountAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
viliambalaz committed Nov 28, 2021
1 parent bb9f03c commit 139cf37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions chcemvediet/adapters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from allauth.account.adapter import DefaultAccountAdapter
from django.contrib.auth import get_backends

from poleno.invitations.adapters import InvitationsAdapter


backend = get_backends()[0]

class AccountAdapter(InvitationsAdapter, DefaultAccountAdapter):
def login(self, request, user):
if not hasattr(user, u'backend'):
user.backend = u'{}.{}'.format(backend.__module__, backend.__class__.__name__)
return super(AccountAdapter, self).login(request, user)
2 changes: 1 addition & 1 deletion chcemvediet/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
)

# Django-allauth settings
ACCOUNT_ADAPTER = u'poleno.invitations.adapters.InvitationsAdapter'
ACCOUNT_ADAPTER = u'chcemvediet.adapters.AccountAdapter'
ACCOUNT_AUTHENTICATION_METHOD = u'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = u'optional'
Expand Down

0 comments on commit 139cf37

Please sign in to comment.