diff options
author | MS <ms@taler.net> | 2021-01-26 15:38:40 +0100 |
---|---|---|
committer | MS <ms@taler.net> | 2021-01-26 15:38:40 +0100 |
commit | b3e1134bff120be95066f019e9feb4f9704e8e0d (patch) | |
tree | a0310b9d52a431e64d24dce588bd9f7c4df19716 /cli | |
parent | 645784b8f2c241b32446d638a1bfb20cb0dc948e (diff) | |
download | libeufin-b3e1134bff120be95066f019e9feb4f9704e8e0d.tar.gz libeufin-b3e1134bff120be95066f019e9feb4f9704e8e0d.tar.bz2 libeufin-b3e1134bff120be95066f019e9feb4f9704e8e0d.zip |
equip CLI with password change
Diffstat (limited to 'cli')
-rwxr-xr-x | cli/bin/libeufin-cli | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cli/bin/libeufin-cli b/cli/bin/libeufin-cli index c7aabe54..7ae7237a 100755 --- a/cli/bin/libeufin-cli +++ b/cli/bin/libeufin-cli @@ -86,6 +86,33 @@ def list_users(obj): print(resp.content.decode("utf-8")) +@users.command(help="Change user's password") +@click.argument("username") +@click.option( + "--new-password", + help="New password", + prompt=True, + hide_input=True, + confirmation_prompt=True, +) +@click.pass_obj +def change_password(obj, username, new_password): + url = urljoin(obj.nexus_base_url, f"/users/password") + try: + body = dict(newPassword=new_password) + resp = post( + url, + json=body, + auth=auth.HTTPBasicAuth(obj.nexus_username, obj.nexus_password), + ) + except Exception as e: + print(e) + print("Could not reach nexus at " + url) + exit(1) + + tell_user(resp) + + @users.command("create", help="Create a new user") @click.argument("username") @click.option( |