Mercurial > prosody-modules
changeset 4079:b68b917e568f
mod_invites: Include invite type and uri in validated invites (from Snikket)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 07 Sep 2020 13:02:51 +0100 |
parents | 2f0c8670d2fa |
children | 14a3f5223074 |
files | mod_invites/mod_invites.lua |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_invites/mod_invites.lua Mon Sep 07 13:00:43 2020 +0100 +++ b/mod_invites/mod_invites.lua Mon Sep 07 13:02:51 2020 +0100 @@ -101,12 +101,13 @@ local valid_until, inviter; + -- Fetch from host store (account invite) + local token_info = token_storage:get(nil, token); + if username then -- token being used for subscription -- Fetch from user store (subscription invite) valid_until = token_storage:get(username, token); else -- token being used for account creation - -- Fetch from host store (account invite) - local token_info = token_storage:get(nil, token); valid_until = token_info and token_info.expires; if token_info.type == "roster" then username = jid_node(token_info.jid); @@ -126,6 +127,8 @@ token = token; username = username; inviter = inviter; + type = token_info and token_info.type or "roster"; + uri = token_info and token_info.uri or get_uri("roster", username.."@"..module.host, token); additional_data = token_info and token_info.additional_data or nil; }, valid_invite_mt); end