mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Switch to use simple hashed passwords instead of per-user salt
This commit is contained in:
@@ -56,6 +56,12 @@ class LoginHandler(BaseHandler):
|
|||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
return rc.NOT_HERE
|
return rc.NOT_HERE
|
||||||
|
|
||||||
d = { 'id': u.id, 'username': u.username, 'password': u.password, 'email': u.email, 'groups': u.groups.all() }
|
d = { 'auth': 'ok', 'id': u.id, 'username': u.username,
|
||||||
return d
|
'password': u.password, 'email': u.email, 'groups': u.groups.all(),
|
||||||
|
'characters': EVEPlayerCharacter.objects.filter(eveaccount__user=u) }
|
||||||
|
|
||||||
|
if request.GET['pass'] == user.password:
|
||||||
|
return d
|
||||||
|
|
||||||
|
return { 'auth': 'failed' }
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,11 @@ DISABLE_SERVICES = False
|
|||||||
# Services API generates a new password for the user
|
# Services API generates a new password for the user
|
||||||
GENERATE_SERVICE_PASSWORD = False
|
GENERATE_SERVICE_PASSWORD = False
|
||||||
|
|
||||||
|
AUTHENTICATION_BACKENDS = (
|
||||||
|
'sso.backends.SimpleHashModelBackend',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
AUTH_PROFILE_MODULE = 'sso.SSOUser'
|
AUTH_PROFILE_MODULE = 'sso.SSOUser'
|
||||||
LOGIN_REDIRECT_URL = "/profile"
|
LOGIN_REDIRECT_URL = "/profile"
|
||||||
LOGIN_URL = "/login"
|
LOGIN_URL = "/login"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class SimpleHashModelBackend(ModelBackend):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
if '$' in user.password:
|
if '$' in user.password:
|
||||||
if user.check_password(password)
|
if user.check_password(password):
|
||||||
user.password = sha1(password).hexdigest()
|
user.password = sha1(password).hexdigest()
|
||||||
user.save()
|
user.save()
|
||||||
return user
|
return user
|
||||||
|
|||||||
Reference in New Issue
Block a user