Skip to content
Permalink
Browse files

Removed deprecated ACCOUNT_USE_AUTH_AUTHENTICATE

  • Loading branch information
brosner committed Sep 9, 2016
1 parent 384476a commit 9c3f71c9145984bb0a75e693c853afbe9a169287
Showing with 2 additions and 44 deletions.
  1. +1 −0 CHANGELOG.md
  2. +0 −1 account/conf.py
  3. +1 −10 account/views.py
  4. +0 −28 docs/faq.rst
  5. +0 −5 docs/settings.rst
@@ -7,6 +7,7 @@ version with these. Your code will need to be updated to continue working.

* BI: account deletion callbacks moved to hooksets
* BI: dropped Django 1.7 support
* BI: removed deprecated `ACCOUNT_USE_AUTH_AUTHENTICATE` setting with behavior matching its `True` value
* added Turkish translations
* fixed migration with language codes to dynamically set

@@ -55,7 +55,6 @@ class AccountAppConf(AppConf):
HOOKSET = "account.hooks.AccountDefaultHookSet"
TIMEZONES = TIMEZONES
LANGUAGES = LANGUAGES
USE_AUTH_AUTHENTICATE = False

def configure_hookset(self, value):
return load_path_attr(value)()
@@ -282,16 +282,7 @@ def after_signup(self, form):
signals.user_signed_up.send(sender=SignupForm, user=self.created_user, form=form)

def login_user(self):
user = self.created_user
if settings.ACCOUNT_USE_AUTH_AUTHENTICATE:
# call auth.authenticate to ensure we set the correct backend for
# future look ups using auth.get_user().
user = auth.authenticate(**self.user_credentials())
else:
# set auth backend to ModelBackend, but this may not be used by
# everyone. this code path is deprecated and will be removed in
# favor of using auth.authenticate above.
user.backend = "django.contrib.auth.backends.ModelBackend"
user = auth.authenticate(**self.user_credentials())
auth.login(self.request, user)
self.request.session.set_expiry(0)

@@ -37,31 +37,3 @@ because you can choose not to do any email address storage.
If you don't use a custom user model then make sure you take extra precaution.
When editing email addresses either in the shell or admin make sure you update
in both places. Only the primary email address is stored on the ``User`` model.

Why does auto-login after sign up not log my user in?
=====================================================

If you are using Django 1.6+ and ``django.contrib.auth.backends.ModelBackend``
does not exist in your ``AUTHENTICATION_BACKENDS`` then you will experience an
issue where users are not logged in after sign up (when
``ACCOUNT_EMAIL_CONFIRMATION_REQUIRED`` is ``False``.)

This has been fixed, but the default behavior is buggy (for this use case) to
maintain backward compatibility. In a future version of django-user-accounts
the default behavior will not be buggy.

To fix, simply set::

ACCOUNT_USE_AUTH_AUTHENTICATE = True

in your Django settings. This will cause the ``login_user`` method of
``SignupView`` to use proper backend authentication to determine the correct
authentication backend for the user. You will need to make sure that
``SignupView.identifier_field`` is set to represent the correct field on the
sign up form to use as the username for credentials. By default the ``username``
field is used (to be consistent with the default username authentication used
for log in.)

If you have a custom need for user credentials passed to the authentication
backends, you may override the behavior using the hookset
``get_user_credentials``.
@@ -148,8 +148,3 @@ Default: ``list(zip(pytz.all_timezones, pytz.all_timezones))``
=====================

See full list in: https://github.com/pinax/django-user-accounts/blob/master/account/language_list.py

``ACCOUNT_USE_AUTH_AUTHENTICATE``
=================================

Default: ``False``

0 comments on commit 9c3f71c

Please sign in to comment.
You can’t perform that action at this time.