Software /
code /
prosody
Changeset
13598:2cd43975a15c
mod_admin_shell: user:password(): Support prompting for password if none given
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 07 Jan 2025 19:25:12 +0000 |
parents | 13597:62aca6adcfd3 |
children | 13599:54803fb5b4d4 |
files | plugins/mod_admin_shell.lua |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua Tue Jan 07 19:24:05 2025 +0000 +++ b/plugins/mod_admin_shell.lua Tue Jan 07 19:25:12 2025 +0000 @@ -1790,12 +1790,15 @@ 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]]