Skip to content

Instantly share code, notes, and snippets.

@Adarshreddyash
Last active August 4, 2020 10:16
Show Gist options
  • Select an option

  • Save Adarshreddyash/1e63ef43b123e75f3b393a92cde6804e to your computer and use it in GitHub Desktop.

Select an option

Save Adarshreddyash/1e63ef43b123e75f3b393a92cde6804e to your computer and use it in GitHub Desktop.
#Now add this to api/settings.py
AUTH_USER_MODEL = 'users.CustomUser'
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
#setting email field as required one
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
#change optional to mandatory to mandate email verification.
ACCOUNT_EMAIL_VERIFICATION = 'optional'
ACCOUNT_CONFIRM_EMAIL_ON_GET = True
#Change these to set custom page to redirect user after email verification.
ACCOUNT_EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL = '/'
ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = '/
SITE_ID = 1
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
AUTHENTICATION_BACKENDS = (
# default
'django.contrib.auth.backends.ModelBackend',
# email login
'allauth.account.auth_backends.AuthenticationBackend',
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment