Merge branch 'creame-imp-control-user-registration'

This commit is contained in:
Audrey Roy Greenfeld 2016-01-06 21:37:50 -08:00
commit d5a21c2d88
4 changed files with 26 additions and 0 deletions

View File

@ -64,6 +64,7 @@ Listed in alphabetical order
Cristian Vargas `@cdvv7788`_
Cullen Rhodes `@c-rhodes`_
Daniele Tricoli `@eriol`_
David Díaz `@ddiazpinto`_ @DavidDiazPinto
Davur Clementsen `@dsclementsen`_ @davur
Eyad Al Sibai `@eyadsibai`_
Felipe Arruda `@arruda`_
@ -143,3 +144,4 @@ Listed in alphabetical order
.. _@knitatoms: https://github.com/knitatoms
.. _@Travistock: https://github.com/Tavistock
.. _@jvanbrug: https://github.com/jvanbrug
.. _@ddiazpinto: https://github.com/ddiazpinto

View File

@ -45,3 +45,10 @@ DJANGO_OPBEAT_APP_ID OPBEAT['APP_ID'] n/a
DJANGO_OPBEAT_SECRET_TOKEN OPBEAT['SECRET_TOKEN'] n/a raises error
DJANGO_OPBEAT_ORGANIZATION_ID OPBEAT['ORGANIZATION_ID'] n/a raises error
======================================= =========================== ============================================== ======================================================================
--------------
Other Settings
--------------
ACCOUNT_ALLOW_REGISTRATION (=True)
Allow enable or disable user registration through `django-allauth` without disabling other characteristics like authentication and account management.

View File

@ -211,6 +211,9 @@ AUTHENTICATION_BACKENDS = (
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_ADAPTER = '{{cookiecutter.repo_name}}.users.adapter.AccountAdapter'
SOCIALACCOUNT_ADAPTER = '{{cookiecutter.repo_name}}.users.adapter.SocialAccountAdapter'
ACCOUNT_ALLOW_REGISTRATION = True
# Custom user app defaults
# Select the correct user model

View File

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from django.conf import settings
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
class AccountAdapter(DefaultAccountAdapter):
def is_open_for_signup(self, request):
return getattr(settings, 'ACCOUNT_ALLOW_REGISTRATION', True)
class SocialAccountAdapter(DefaultSocialAccountAdapter):
def is_open_for_signup(self, request):
return getattr(settings, 'ACCOUNT_ALLOW_REGISTRATION', True)