mirror of
https://github.com/aljazceru/hummingbot-dashboard.git
synced 2026-01-06 23:14:25 +01:00
fix/helpers
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import streamlit_authenticator as stauth
|
||||
import ruamel.yaml as yaml
|
||||
from ruamel.yaml import YAML
|
||||
import os
|
||||
|
||||
yaml = YAML(typ='safe', pure=True)
|
||||
|
||||
# enter email address
|
||||
new_email = input("Enter dashboard email >> ")
|
||||
|
||||
@@ -13,13 +15,13 @@ if len(new_email) == 0:
|
||||
# load the YAML file
|
||||
yaml_file = "../credentials.yml"
|
||||
with open(yaml_file, "r") as file:
|
||||
data = yaml.safe_load(file)
|
||||
data = yaml.load(file)
|
||||
|
||||
# append the email address to credentials.yml
|
||||
data["preauthorized"]["emails"].append(new_email)
|
||||
|
||||
# write the updated data back to the file
|
||||
with open(yaml_file, "w") as file:
|
||||
yaml.dump(data, file, Dumper=yaml.RoundTripDumper)
|
||||
yaml.dump(data, file)
|
||||
|
||||
print("Email has been successfully added!")
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import streamlit_authenticator as stauth
|
||||
import ruamel.yaml as yaml
|
||||
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"
|
||||
@@ -12,13 +14,13 @@ 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.safe_load(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, Dumper=yaml.RoundTripDumper)
|
||||
yaml.dump(data, file)
|
||||
|
||||
print("Admin password has been updated! ")
|
||||
|
||||
Reference in New Issue
Block a user