Is it possible to prevent account creation under certain circumstances in allauth, preferably using the pre_social_login signal?
With the current development branch you can easily do this. In your settings:
SOCIALACCOUNT_ADAPTER = 'my.adapter.MySocialAccountAdapter'
Then use this adapter.py:
from django.http import HttpResponse
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from allauth.exceptions import ImmediateHttpResponse
class MySocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
raise ImmediateHttpResponse(HttpResponse('Closed for the day'))
Alternatively, raise a similar exception from your pre_social_login
signal (although I do not prefer that approach -- see documentation notes over at https://github.com/pennersr/django-allauth/blob/master/allauth/socialaccount/adapter.py#L15
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With