diff mod_invites/mod_invites.lua @ 4377:a0f1fb5e7829

mod_invites: Add ttl to all public creation APIs
author Matthew Wild <mwild1@gmail.com>
date Sat, 23 Jan 2021 12:56:17 +0000
parents 4b617a246d81
children 94805a7e7b30
line wrap: on
line diff
--- a/mod_invites/mod_invites.lua	Sat Jan 23 12:55:49 2021 +0000
+++ b/mod_invites/mod_invites.lua	Sat Jan 23 12:56:17 2021 +0000
@@ -66,25 +66,25 @@
 end
 
 -- Create invitation to register an account (optionally restricted to the specified username)
-function create_account(account_username, additional_data) --luacheck: ignore 131/create_account
+function create_account(account_username, additional_data, ttl) --luacheck: ignore 131/create_account
 	local jid = account_username and (account_username.."@"..module.host) or module.host;
-	return create_invite("register", jid, true, additional_data);
+	return create_invite("register", jid, true, additional_data, ttl);
 end
 
 -- Create invitation to reset the password for an account
-function create_account_reset(account_username) --luacheck: ignore 131/create_account_reset
-	return create_account(account_username, { allow_reset = account_username });
+function create_account_reset(account_username, ttl) --luacheck: ignore 131/create_account_reset
+	return create_account(account_username, { allow_reset = account_username }, ttl or 86400);
 end
 
 -- Create invitation to become a contact of a local user
-function create_contact(username, allow_registration, additional_data) --luacheck: ignore 131/create_contact
-	return create_invite("roster", username.."@"..module.host, allow_registration, additional_data);
+function create_contact(username, allow_registration, additional_data, ttl) --luacheck: ignore 131/create_contact
+	return create_invite("roster", username.."@"..module.host, allow_registration, additional_data, ttl);
 end
 
 -- Create invitation to register an account and join a user group
 -- If explicit ttl is passed, invite is valid for multiple signups
 -- during that time period
-function create_group(group_ids, ttl, additional_data) --luacheck: ignore 131/create_group
+function create_group(group_ids, additional_data, ttl) --luacheck: ignore 131/create_group
 	local merged_additional_data = {
 		groups = group_ids;
 	};