pythondjangodjango-allauth

django-allauth, how can I only allow signup/login through social?


I only want to allow people to sign up or log in with their social account. I have the social sign up and log in working, but I cant figure out how to disable the local sign up.

I've read the docs and this sounds close to what I want

ACCOUNT_FORMS (={})
    Used to override forms, for example: {‘login’: ‘myapp.forms.LoginForm’}

It seems like I can make a new sign up form and only include the social log in link, but I was hoping there is any easier way that I'm overlooking. I'm still new to this all so I tend to miss the obvious a lot still.

I also tried changing the code below to False, but that disabled social sign up as well.

allauth.account.adapter.py

def is_open_for_signup(self, request):
    """
    Checks whether or not the site is open for signups.

    Next to simply returning True/False you can also intervene the
    regular flow by raising an ImmediateHttpResponse
    """
    return True

Solution

  • The solution wasn't what I originally thought. The much easier way to do this, instead of changing the forms, was to change the template and just remove any other options in that template.

    My page now correctly only shows social auth and I am happy.

    If anyone has a better or more secure answer I'd be open to it. Being new still, I don't know if this is the best solution, but for now it seems great and will mark as answered.