mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-13 22:32:15 +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:
|
||||
return rc.NOT_HERE
|
||||
|
||||
d = { 'id': u.id, 'username': u.username, 'password': u.password, 'email': u.email, 'groups': u.groups.all() }
|
||||
return d
|
||||
d = { 'auth': 'ok', 'id': u.id, 'username': u.username,
|
||||
'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
|
||||
GENERATE_SERVICE_PASSWORD = False
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'sso.backends.SimpleHashModelBackend',
|
||||
)
|
||||
|
||||
|
||||
AUTH_PROFILE_MODULE = 'sso.SSOUser'
|
||||
LOGIN_REDIRECT_URL = "/profile"
|
||||
LOGIN_URL = "/login"
|
||||
|
||||
@@ -12,7 +12,7 @@ class SimpleHashModelBackend(ModelBackend):
|
||||
return None
|
||||
|
||||
if '$' in user.password:
|
||||
if user.check_password(password)
|
||||
if user.check_password(password):
|
||||
user.password = sha1(password).hexdigest()
|
||||
user.save()
|
||||
return user
|
||||
|
||||
Reference in New Issue
Block a user