Make PEP8 cleanup of line spaces and character distances as well as indents
This commit is contained in:
parent
7ff783fea1
commit
b278337172
189 changed files with 2039 additions and 1583 deletions
|
|
@ -1,40 +1,42 @@
|
|||
from django.contrib.auth.backends import ModelBackend
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
|
||||
class CaseInsensitiveModelBackend(ModelBackend):
|
||||
"""
|
||||
By default ModelBackend does case _sensitive_ username
|
||||
authentication, which isn't what is generally expected. This
|
||||
backend supports case insensitive username authentication.
|
||||
"""
|
||||
By default ModelBackend does case _sensitive_ username
|
||||
authentication, which isn't what is generally expected. This
|
||||
backend supports case insensitive username authentication.
|
||||
|
||||
"""
|
||||
def authenticate(self, username=None, password=None, autologin=None):
|
||||
"""
|
||||
Custom authenticate with bypass for auto-logins
|
||||
"""
|
||||
|
||||
Args:
|
||||
username (str, optional): Name of user to authenticate.
|
||||
password (str, optional): Password of user
|
||||
autologin (Account, optional): If given, assume this is
|
||||
an already authenticated account and bypass authentication.
|
||||
"""
|
||||
if autologin:
|
||||
# Note: Setting .backend on account is critical in order to
|
||||
# be allowed to call django.auth.login(account) later. This
|
||||
# is necessary for the auto-login feature of the webclient,
|
||||
# but it's important to make sure Django doesn't change this
|
||||
# requirement or the name of the property down the line. /Griatch
|
||||
autologin.backend = "evennia.web.utils.backends.CaseInsensitiveModelBackend"
|
||||
return autologin
|
||||
else:
|
||||
# In this case .backend will be assigned automatically
|
||||
# somewhere along the way.
|
||||
Account = get_user_model()
|
||||
try:
|
||||
account = Account.objects.get(username__iexact=username)
|
||||
if account.check_password(password):
|
||||
return account
|
||||
else:
|
||||
return None
|
||||
except Account.DoesNotExist:
|
||||
return None
|
||||
def authenticate(self, username=None, password=None, autologin=None):
|
||||
"""
|
||||
Custom authenticate with bypass for auto-logins
|
||||
|
||||
Args:
|
||||
username (str, optional): Name of user to authenticate.
|
||||
password (str, optional): Password of user
|
||||
autologin (Account, optional): If given, assume this is
|
||||
an already authenticated account and bypass authentication.
|
||||
"""
|
||||
if autologin:
|
||||
# Note: Setting .backend on account is critical in order to
|
||||
# be allowed to call django.auth.login(account) later. This
|
||||
# is necessary for the auto-login feature of the webclient,
|
||||
# but it's important to make sure Django doesn't change this
|
||||
# requirement or the name of the property down the line. /Griatch
|
||||
autologin.backend = "evennia.web.utils.backends.CaseInsensitiveModelBackend"
|
||||
return autologin
|
||||
else:
|
||||
# In this case .backend will be assigned automatically
|
||||
# somewhere along the way.
|
||||
Account = get_user_model()
|
||||
try:
|
||||
account = Account.objects.get(username__iexact=username)
|
||||
if account.check_password(password):
|
||||
return account
|
||||
else:
|
||||
return None
|
||||
except Account.DoesNotExist:
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ WEBSOCKET_CLIENT_ENABLED = settings.WEBSOCKET_CLIENT_ENABLED
|
|||
WEBSOCKET_PORT = settings.WEBSOCKET_CLIENT_PORT
|
||||
WEBSOCKET_URL = settings.WEBSOCKET_CLIENT_URL
|
||||
|
||||
|
||||
def general_context(request):
|
||||
"""
|
||||
Returns common Evennia-related context stuff, which
|
||||
|
|
@ -50,9 +51,9 @@ def general_context(request):
|
|||
'evennia_entityapps': GAME_ENTITIES,
|
||||
'evennia_setupapps': GAME_SETUP,
|
||||
'evennia_connectapps': CONNECTIONS,
|
||||
'evennia_websiteapps':WEBSITE,
|
||||
"webclient_enabled" : WEBCLIENT_ENABLED,
|
||||
"websocket_enabled" : WEBSOCKET_CLIENT_ENABLED,
|
||||
"websocket_port" : WEBSOCKET_PORT,
|
||||
"websocket_url" : WEBSOCKET_URL
|
||||
'evennia_websiteapps': WEBSITE,
|
||||
"webclient_enabled": WEBCLIENT_ENABLED,
|
||||
"websocket_enabled": WEBSOCKET_CLIENT_ENABLED,
|
||||
"websocket_port": WEBSOCKET_PORT,
|
||||
"websocket_url": WEBSOCKET_URL
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue