Make sure to filtered already-expired tokens from the "expiring soon" tokens

This commit is contained in:
Joseph Schorr 2018-02-12 17:07:50 -05:00
parent 8c14a8fdf2
commit e1a3857de9
1 changed files with 2 additions and 1 deletions

View File

@ -60,7 +60,8 @@ def get_expiring_tokens(user, soon):
return (AppSpecificAuthToken
.select()
.where(AppSpecificAuthToken.user == user,
AppSpecificAuthToken.expiration <= soon_datetime))
AppSpecificAuthToken.expiration <= soon_datetime,
AppSpecificAuthToken.expiration > datetime.now()))
def gc_expired_tokens(user):