mirror of https://github.com/django/django.git
[1.10.x] Fixed #27292 -- Removed unnecessary password assignment in auth backend example.
Backport of e262f00231
from master
This commit is contained in:
parent
fbd4fa2ec6
commit
7652f97a5c
|
@ -134,7 +134,7 @@ object the first time a user authenticates::
|
||||||
"""
|
"""
|
||||||
Authenticate against the settings ADMIN_LOGIN and ADMIN_PASSWORD.
|
Authenticate against the settings ADMIN_LOGIN and ADMIN_PASSWORD.
|
||||||
|
|
||||||
Use the login name, and a hash of the password. For example:
|
Use the login name and a hash of the password. For example:
|
||||||
|
|
||||||
ADMIN_LOGIN = 'admin'
|
ADMIN_LOGIN = 'admin'
|
||||||
ADMIN_PASSWORD = 'pbkdf2_sha256$30000$Vo0VlMnkR4Bk$qEvtdyZRWTcOsCnI/oQ7fVOu1XAURIZYoOZ3iq8Dr4M='
|
ADMIN_PASSWORD = 'pbkdf2_sha256$30000$Vo0VlMnkR4Bk$qEvtdyZRWTcOsCnI/oQ7fVOu1XAURIZYoOZ3iq8Dr4M='
|
||||||
|
@ -147,10 +147,9 @@ object the first time a user authenticates::
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(username=username)
|
user = User.objects.get(username=username)
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
# Create a new user. Note that we can set password
|
# Create a new user. There's no need to set a password
|
||||||
# to anything, because it won't be checked; the password
|
# because only the password from settings.py is checked.
|
||||||
# from settings.py will.
|
user = User(username=username)
|
||||||
user = User(username=username, password='get from settings.py')
|
|
||||||
user.is_staff = True
|
user.is_staff = True
|
||||||
user.is_superuser = True
|
user.is_superuser = True
|
||||||
user.save()
|
user.save()
|
||||||
|
|
Loading…
Reference in New Issue