Software /
code /
prosody
Changeset
12996:e8716515405e
mod_tokenauth: return error if storage of new token fails
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 26 Mar 2023 15:53:27 +0100 |
parents | 12995:e385f3a06673 |
children | 12997:0a56b84ec4ad |
files | plugins/mod_tokenauth.lua |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_tokenauth.lua Sun Mar 26 14:06:04 2023 +0100 +++ b/plugins/mod_tokenauth.lua Sun Mar 26 15:53:27 2023 +0100 @@ -54,10 +54,13 @@ local token_secret = random.bytes(18); local token = "secret-token:"..base64.encode("2;"..token_id..";"..token_secret..";"..jid.join(token_username, token_host)); - token_store:set(token_username, token_id, { + local ok, err = token_store:set(token_username, token_id, { secret_sha256 = hashes.sha256(token_secret, true); token_info = token_info }); + if not ok then + return nil, err; + end return token, token_info; end