# HG changeset patch # User Matthew Wild # Date 1766155790 0 # Node ID f0b2a05bcedc99930cb5e2a3b0db588e3009da16 # Parent f77911437539cecdc85609a86403563f91eba59f mod_invites: Return error when generating password reset for non-existent account diff -r f77911437539 -r f0b2a05bcedc plugins/mod_invites.lua --- a/plugins/mod_invites.lua Fri Dec 12 12:43:23 2025 +0000 +++ b/plugins/mod_invites.lua Fri Dec 19 14:49:50 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;