changeset 14083:486d42764da9

mod_invites: Allow specifying --reusable for invites created via shell commands
author Matthew Wild <mwild1@gmail.com>
date Mon, 16 Feb 2026 17:56:02 +0000
parents 13b3220c3282
children 414e731b5972
files plugins/mod_invites.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_invites.lua	Mon Feb 16 17:55:08 2026 +0000
+++ b/plugins/mod_invites.lua	Mon Feb 16 17:56:02 2026 +0000
@@ -261,7 +261,7 @@
 	flags = {
 		array_params = { role = true, group = have_group_invites };
 		value_params = { expires_after = true };
-		bool_params = { admin = true };
+		bool_params = { admin = true, reusable = true };
 	};
 
 	handler = function (self, user_jid, opts) --luacheck: ignore 212/self
@@ -285,7 +285,7 @@
 		local invite = assert(create_account(username, {
 			roles = roles;
 			groups = groups;
-		}, ttl));
+		}, ttl, opts.reusable));
 
 		return true, invite.landing_page or invite.uri;
 	end;
@@ -330,7 +330,7 @@
 	host_selector = "user_jid";
 	flags = {
 		value_params = { expires_after = true };
-		bool_params = { allow_registration = true };
+		bool_params = { allow_registration = true, reusable = true };
 	};
 
 	handler = function (self, user_jid, opts) --luacheck: ignore 212/self
@@ -345,7 +345,7 @@
 				return nil, "Unable to parse duration: "..opts.expires_after;
 			end
 		end
-		local invite, err = create_contact(username, opts and opts.allow_registration, nil, ttl);
+		local invite, err = create_contact(username, opts and opts.allow_registration, nil, ttl, opts.reusable);
 		if not invite then return nil, err; end
 		return true, invite.landing_page or invite.uri;
 	end;