|
|
|
@ -445,6 +445,21 @@ def add_user(name, password):
|
|
|
|
|
print(f"{user.name}({user.id}) added to database.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cli.command()
|
|
|
|
|
@click.option("--name", prompt="Enter username")
|
|
|
|
|
@click.option(
|
|
|
|
|
"--password", prompt="Enter password", hide_input=True, confirmation_prompt=True
|
|
|
|
|
)
|
|
|
|
|
def update_user(name, password):
|
|
|
|
|
user = (
|
|
|
|
|
db_session.execute(select(User).where(User.name == name)).unique().scalar_one()
|
|
|
|
|
)
|
|
|
|
|
user.password = generate_password_hash(password)
|
|
|
|
|
db_session.add(user)
|
|
|
|
|
db_session.commit()
|
|
|
|
|
print(f"{user.name}({user.id}) updated.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
cli()
|
|
|
|
|
print("Running setup")
|
|
|
|
|