Software /
code /
prosody
Changeset
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 |
parents | 13794:471b676e64eb |
children | 13797:c0ef5d089e76 13798:35819bc9471a |
files | plugins/mod_admin_shell.lua util/prosodyctl/shell.lua |
diffstat | 2 files changed, 12 insertions(+), 2 deletions(-) [+] |
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);
--- a/util/prosodyctl/shell.lua Mon Mar 31 16:25:09 2025 +0100 +++ b/util/prosodyctl/shell.lua Mon Mar 31 17:30:50 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);