Software / code / prosody
Diff
plugins/mod_admin_shell.lua @ 13594:abbdcef552fb
mod_admin_shell: user:create(): request password via prompt if none given
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 07 Jan 2025 18:17:57 +0000 |
| parent | 13593:f57872788424 |
| child | 13596:85e8cc6870ae |
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua Tue Jan 07 18:17:30 2025 +0000 +++ b/plugins/mod_admin_shell.lua Tue Jan 07 18:17:57 2025 +0000 @@ -1724,12 +1724,13 @@ 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]]