Here are the examples of the python api django.conf.settings.ADMIN_LOGIN taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
Source : auth.py
with GNU Affero General Public License v3.0
from palfrey
with GNU Affero General Public License v3.0
from palfrey
def authenticate(self, request, username=None, password=None):
login_valid = (settings.ADMIN_LOGIN == username)
if settings.ADMIN_PASSWORD.startswith("pbkdf2_sha256"):
pwd_valid = check_password(password, settings.ADMIN_PASSWORD)
else:
pwd_valid = password == settings.ADMIN_PASSWORD
if login_valid and pwd_valid:
try:
user = User.objects.get(username=username)
except User.DoesNotExist:
# Create a new user. There's no need to set a password
# because only the password from settings.py is checked.
user = User(username=username)
user.is_staff = True
user.is_superuser = True
user.save()
return user
return None
def get_user(self, user_id):