From a6321f52d882b16647dc2a423c6fa1f03b567865 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Thu, 15 Sep 2022 22:47:36 +0200 Subject: [PATCH] Add task to reset password --- tasks.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tasks.py b/tasks.py index c36ae07..cfa9bf8 100644 --- a/tasks.py +++ b/tasks.py @@ -312,3 +312,18 @@ def yunohost_config( summary=summary, password=password, ) + + +@task +def reset_password(ctx): + # type: (Context) -> None + import bcrypt + from prompt_toolkit import prompt + + new_password = bcrypt.hashpw( + prompt("New admin password: ", is_password=True).encode(), bcrypt.gensalt() + ).decode() + + print() + print("Update data/profile.toml with:") + print(f'admin_password = "{new_password}"')