Fix password type identifications

Sha1's start with sha1$, not sha1_ (and this is not a SQL LIKE match).
And fix parameters when calling re.match in the unmatched case.
This commit is contained in:
Magnus Hagander
2020-09-26 17:50:44 +02:00
parent a6a860f092
commit 25675b1479

View File

@ -80,9 +80,9 @@ class PGUserChangeForm(UserChangeForm):
return "OAuth integrated"
elif obj.password.startswith('pbkdf2_'):
return "Regular password"
elif obj.password.startswith('sha1_'):
elif obj.password.startswith('sha1$'):
return "Old SHA1 password"
elif re.match('^[a-z0-9]{64}'):
elif re.match('^[a-z0-9]{64}', obj.password):
return "Old unknown hash"
else:
return "Unknown"