diff plugins/mod_invites.lua @ 14015:42e035cd3322

Merge 13.0->trunk
author Matthew Wild <mwild1@gmail.com>
date Fri, 19 Dec 2025 14:50:10 +0000
parents b019a30cc1b2 f0b2a05bcedc
children 13b3220c3282
line wrap: on
line diff
--- a/plugins/mod_invites.lua	Mon Dec 15 12:14:27 2025 +0000
+++ b/plugins/mod_invites.lua	Fri Dec 19 14:50:10 2025 +0000
@@ -1,5 +1,6 @@
 local id = require "prosody.util.id";
 local it = require "prosody.util.iterators";
+local usermanager = require "prosody.core.usermanager";
 local url = require "socket.url";
 local jid_node = require "prosody.util.jid".node;
 local jid_split = require "prosody.util.jid".split;
@@ -302,10 +303,13 @@
 	};
 
 	handler = function (self, user_jid, opts) --luacheck: ignore 212/self
-		local username = jid_split(user_jid);
+		local username, host = jid_split(user_jid);
 		if not username then
 			return nil, "Supply the JID of the account you want to generate a password reset for";
 		end
+		if not usermanager.user_exists(username, host) then
+			return nil, "The specified user account does not exist: " .. username;
+		end
 		local duration_sec = require "prosody.util.human.io".parse_duration(opts and opts.expires_after or "1d");
 		if not duration_sec then
 			return nil, "Unable to parse duration: "..opts.expires_after;