Add task to reset password
This commit is contained in:
parent
4e1e4d0ea8
commit
a6321f52d8
1 changed files with 15 additions and 0 deletions
15
tasks.py
15
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}"')
|
||||
|
|
Loading…
Reference in a new issue