Mercurial > prosody-hg
comparison plugins/mod_tokenauth.lua @ 12999:c87ac7d1967f
mod_tokenauth: Fix traceback when checking expiry of tokens with no expiry
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 27 Mar 2023 20:51:07 +0100 |
| parents | 601d9a375b86 |
| children | c7253174503e |
comparison
equal
deleted
inserted
replaced
| 12998:601d9a375b86 | 12999:c87ac7d1967f |
|---|---|
| 121 | 121 |
| 122 local function clear_expired_grant_tokens(grant, now) | 122 local function clear_expired_grant_tokens(grant, now) |
| 123 local updated; | 123 local updated; |
| 124 now = now or os.time(); | 124 now = now or os.time(); |
| 125 for secret, token_info in pairs(grant.tokens) do | 125 for secret, token_info in pairs(grant.tokens) do |
| 126 if token_info.expires < now then | 126 local expires = token_info.expires; |
| 127 if expires and expires < now then | |
| 127 grant.tokens[secret] = nil; | 128 grant.tokens[secret] = nil; |
| 128 updated = true; | 129 updated = true; |
| 129 end | 130 end |
| 130 end | 131 end |
| 131 return updated; | 132 return updated; |
