aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2025-01-07 19:25:12 +0000
committerMatthew Wild <mwild1@gmail.com>2025-01-07 19:25:12 +0000
commit6ff135c812925423cd0bf81254ea04cf18851823 (patch)
treefbed209619a05858b4db492b4a3650521f39498e
parent54de66e7b0e41310db82d2c26f221ad4d1321669 (diff)
downloadprosody-6ff135c812925423cd0bf81254ea04cf18851823.tar.gz
prosody-6ff135c812925423cd0bf81254ea04cf18851823.zip
mod_admin_shell: user:password(): Support prompting for password if none given
-rw-r--r--plugins/mod_admin_shell.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua
index 5c5b0b48..4f8e6094 100644
--- a/plugins/mod_admin_shell.lua
+++ b/plugins/mod_admin_shell.lua
@@ -1790,12 +1790,15 @@ function def_env.user:password(jid, password)
elseif not um.user_exists(username, host) then
return nil, "No such user";
end
- local ok, err = um.set_password(username, password, host, nil);
- if ok then
- return true, "User password changed";
- else
- return nil, "Could not change password for user: "..err;
- end
+
+ return promise.resolve(password or self.session.request_input("password")):next(function (password_)
+ local ok, err = um.set_password(username, password_, host, nil);
+ if ok then
+ return "User password changed";
+ else
+ return promise.reject("Could not change password for user: "..err);
+ end
+ end);
end
describe_command [[user:roles(jid, host) - Show current roles for an user]]