# HG changeset patch # User Matthew Wild # Date 1736277912 0 # Node ID 2cd43975a15c8519f96de0eefaa08ffa4655e08c # Parent 62aca6adcfd3953f628c085e0b2a0ce9439ace06 mod_admin_shell: user:password(): Support prompting for password if none given diff -r 62aca6adcfd3 -r 2cd43975a15c plugins/mod_admin_shell.lua --- 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]]