22 lines
688 B
Python
22 lines
688 B
Python
|
from allauth.account.adapter import DefaultAccountAdapter
|
||
|
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
|
||
|
|
||
|
|
||
|
class AccountAdapter(DefaultAccountAdapter):
|
||
|
def is_open_for_signup(self, request):
|
||
|
"""
|
||
|
Signup is not allowed by default.
|
||
|
"""
|
||
|
return False
|
||
|
|
||
|
|
||
|
class SocialAccountAdapter(DefaultSocialAccountAdapter):
|
||
|
def is_open_for_signup(self, request, sociallogin):
|
||
|
"""
|
||
|
Authorize user connecting via Clipper to get a GestioCOF account.
|
||
|
"""
|
||
|
provider = sociallogin.account.provider
|
||
|
if provider == "clipper":
|
||
|
return True
|
||
|
return super().is_open_for_signup(request, sociallogin)
|