Changeset

13797:c0ef5d089e76

Merge 13.0->trunk
author Matthew Wild <mwild1@gmail.com>
date Mon, 31 Mar 2025 17:32:11 +0100
parents 13795:99ba0b89e531 (current diff) 13796:c8e534b4f2e2 (diff)
children 13799:a353db59f942
files
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua	Mon Mar 31 16:43:06 2025 +0100
+++ b/plugins/mod_admin_shell.lua	Mon Mar 31 17:32:11 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);
 
--- a/util/prosodyctl/shell.lua	Mon Mar 31 16:43:06 2025 +0100
+++ b/util/prosodyctl/shell.lua	Mon Mar 31 17:32:11 2025 +0100
@@ -134,7 +134,11 @@
 		end
 		if stanza.attr.type == "password" then
 			local password = human_io.read_password();
-			client.send(st.stanza("repl-requested-input", { type = stanza.attr.type, id = stanza.attr.id }):text(password));
+			client.send(st.stanza("repl-requested-input", {
+				type = stanza.attr.type;
+				id = stanza.attr.id;
+				status = password and "submit" or "cancel";
+			}):text(password or ""));
 		else
 			io.stderr:write("Internal error - unexpected input request type "..tostring(stanza.attr.type).."\n");
 			os.exit(1);