Merged in [19382] from krathnayake@ietf.org:
Adds ability to hanndle garbage API keys. Fixes #3412.
- Legacy-Id: 19386
Note: SVN reference [19382] has been migrated to Git commit 02b8559512
This commit is contained in:
commit
704f2693e0
|
@ -387,9 +387,9 @@ class PersonalApiKey(models.Model):
|
|||
assert isinstance(s, bytes)
|
||||
try:
|
||||
key = base64.urlsafe_b64decode(s)
|
||||
id, salt, hash = struct.unpack(KEY_STRUCT, key)
|
||||
except Exception:
|
||||
return None
|
||||
id, salt, hash = struct.unpack(KEY_STRUCT, key)
|
||||
k = cls.objects.filter(id=id)
|
||||
if not k.exists():
|
||||
return None
|
||||
|
|
Loading…
Reference in a new issue