mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-11 20:13:02 +00:00
Backport PR #3910: use equality to filter token prefixes
This commit is contained in:

committed by
MeeseeksDev[bot]
![MeeseeksDev[bot]](/assets/img/avatar_default.png)
parent
fe64595d75
commit
9f23bc2959
@@ -536,9 +536,7 @@ class Hashed(Expiring):
|
|||||||
prefix = token[: cls.prefix_length]
|
prefix = token[: cls.prefix_length]
|
||||||
# since we can't filter on hashed values, filter on prefix
|
# since we can't filter on hashed values, filter on prefix
|
||||||
# so we aren't comparing with all tokens
|
# so we aren't comparing with all tokens
|
||||||
prefix_match = db.query(cls).filter(
|
prefix_match = db.query(cls).filter_by(prefix=prefix)
|
||||||
bindparam('prefix', prefix).startswith(cls.prefix)
|
|
||||||
)
|
|
||||||
prefix_match = prefix_match.filter(
|
prefix_match = prefix_match.filter(
|
||||||
or_(cls.expires_at == None, cls.expires_at >= cls.now())
|
or_(cls.expires_at == None, cls.expires_at >= cls.now())
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user