Diff

plugins/mod_admin_shell.lua @ 13796:c8e534b4f2e2 13.0

mod_admin_shell, prosodyctl shell: Report command failure when no password entered (fixes #1907)
author Matthew Wild <mwild1@gmail.com>
date Mon, 31 Mar 2025 17:30:50 +0100
parent 13770:a28349b8a387
child 13819:3ee95eb17045
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua	Mon Mar 31 16:25:09 2025 +0100
+++ b/plugins/mod_admin_shell.lua	Mon Mar 31 17:30:50 2025 +0100
@@ -205,7 +205,13 @@
 		event.origin.send(st.stanza("repl-result", { type = "error" }):text("Internal error - unexpected input"));
 		return true;
 	end
-	input_promise.resolve(event.stanza:get_text());
+	local status = event.stanza.attr.status or "submit";
+	local text = event.stanza:get_text();
+	if status == "submit" then
+		input_promise.resolve(text);
+	else
+		input_promise.reject(status == "cancel" and (text ~= "" and text)  or "cancelled");
+	end
 	return true;
 end);