mirror of
https://github.com/aljazceru/hummingbot-dashboard.git
synced 2025-12-30 11:34:25 +01:00
27 lines
747 B
Python
27 lines
747 B
Python
import streamlit_authenticator as stauth
|
|
from ruamel.yaml import YAML
|
|
import os
|
|
|
|
yaml = YAML(typ='safe', pure=True)
|
|
|
|
# enter admin password or use default t3st01
|
|
new_password = input("Enter dashboard password >> ")
|
|
new_password = new_password or "t3st01"
|
|
|
|
# extract the hash password from the List
|
|
hash_password = stauth.Hasher([new_password]).generate()[0]
|
|
|
|
# load the YAML file
|
|
yaml_file = "../credentials.yml"
|
|
with open(yaml_file, "r") as file:
|
|
data = yaml.load(file)
|
|
|
|
# update the admin password on credentials.yml
|
|
data["credentials"]["usernames"]["admin"]["password"] = hash_password
|
|
|
|
# write the updated data back to the file
|
|
with open(yaml_file, "w") as file:
|
|
yaml.dump(data, file)
|
|
|
|
print("Admin password has been updated! ")
|