diff options
author | Matthew Wild <mwild1@gmail.com> | 2025-01-07 18:17:57 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2025-01-07 18:17:57 +0000 |
commit | 54718fffe02d14ffa22a615bd03fc00faba1f819 (patch) | |
tree | ca7984eedcadd541a7dde196e2c75ed5220ad4f2 | |
parent | 7a9bc06049b4582294c16e2b4ceb7148abae188e (diff) | |
download | prosody-54718fffe02d14ffa22a615bd03fc00faba1f819.tar.gz prosody-54718fffe02d14ffa22a615bd03fc00faba1f819.zip |
mod_admin_shell: user:create(): request password via prompt if none given
-rw-r--r-- | plugins/mod_admin_shell.lua | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua index 46c7494d..2cc5b17c 100644 --- a/plugins/mod_admin_shell.lua +++ b/plugins/mod_admin_shell.lua @@ -1724,12 +1724,13 @@ function def_env.user:create(jid, password, role) role = module:get_option_string("default_provisioned_role", "prosody:member"); end - local ok, err = um.create_user_with_role(username, password, host, role); - if not ok then - return nil, "Could not create user: "..err; - end - - return true, ("Created %s with role '%s'"):format(jid, role); + return promise.resolve(password or self.session.request_input("password")):next(function (password_) + local ok, err = um.create_user_with_role(username, password_, host, role); + if not ok then + return nil, "Could not create user: "..err; + end + return ("Created %s with role '%s'"):format(jid, role); + end); end describe_command [[user:disable(jid) - Disable the specified user account, preventing login]] |