Accounts |
A custom email auth for Django
Detailed documentation is in the "docs" directory.
Add "accounts" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = ( ... 'accounts', 'bootstrapform', )
Add this to your settings.py:
AUTH_USER_MODEL = 'accounts.User' AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'accounts.backends.EmailAuth', )
Include the accounts URLconf in your project urls.py like this:
url(r'^accounts/', include('accounts.urls')),
- Run python manage.py migrate to create the accounts models.
- user the 'login' and 'register' url names to create links from your home page
EXTRAS
If you want to change the login success url change your urls.py like so:
...
from accounts.views import login
...
# add a new success url to the account login
url(r'^accounts/login/$', login, { 'success_url': 'name of view to go to when using resolve()' }, name='login'),
# import the rest of the accounts urls after so the override is
# processed first by the urls system
url(r'^accounts/', include('accounts.urls')),
If you want to change the Form object used to display registrations do the following:
...
from accounts.views import register
...
# add a new success url to the account login
url(r'^accounts/register/$', register, { 'register_form': MyRegisterFormClass }, name='register'),
# import the rest of the accounts urls after so the override is
# processed first by the urls system
url(r'^accounts/', include('accounts.urls')),