Skip to content

Commit

Permalink
Removed deprecated ACCOUNT_USE_AUTH_AUTHENTICATE
Browse files Browse the repository at this point in the history
  • Loading branch information
brosner committed Sep 9, 2016
1 parent 384476a commit 9c3f71c
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 44 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion account/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)()
11 changes: 1 addition & 10 deletions account/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
28 changes: 0 additions & 28 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
5 changes: 0 additions & 5 deletions docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.