Update app.py
Browse files
app.py
CHANGED
@@ -67,7 +67,7 @@ def verify_password(stored_password, provided_password):
|
|
67 |
|
68 |
def auth():
|
69 |
if st.session_state.user is None:
|
70 |
-
st.subheader("Welcome to the HeadPeace")
|
71 |
|
72 |
# Instructions
|
73 |
with st.expander("How to Use This App", expanded=True):
|
@@ -110,6 +110,11 @@ def auth():
|
|
110 |
reg_password = st.text_input("Choose a Password", type="password", key="reg_password")
|
111 |
confirm_password = st.text_input("Confirm Password", type="password", key="confirm_password")
|
112 |
user_type = st.selectbox("User Type", ["Patient", "Doctor"])
|
|
|
|
|
|
|
|
|
|
|
113 |
register_button = st.button("Register")
|
114 |
|
115 |
if register_button:
|
@@ -120,6 +125,8 @@ def auth():
|
|
120 |
st.error("Passwords do not match.")
|
121 |
elif len(reg_password) < 8:
|
122 |
st.error("Password must be at least 8 characters long.")
|
|
|
|
|
123 |
else:
|
124 |
hashed_password = hash_password(reg_password)
|
125 |
save_user_data(reg_username, hashed_password, user_type)
|
|
|
67 |
|
68 |
def auth():
|
69 |
if st.session_state.user is None:
|
70 |
+
st.subheader("Welcome to the HeadPeace 🧠")
|
71 |
|
72 |
# Instructions
|
73 |
with st.expander("How to Use This App", expanded=True):
|
|
|
110 |
reg_password = st.text_input("Choose a Password", type="password", key="reg_password")
|
111 |
confirm_password = st.text_input("Confirm Password", type="password", key="confirm_password")
|
112 |
user_type = st.selectbox("User Type", ["Patient", "Doctor"])
|
113 |
+
|
114 |
+
doctor_code = ""
|
115 |
+
if user_type == "Doctor":
|
116 |
+
doctor_code = st.text_input("Enter Doctor Registration Code", type="password")
|
117 |
+
|
118 |
register_button = st.button("Register")
|
119 |
|
120 |
if register_button:
|
|
|
125 |
st.error("Passwords do not match.")
|
126 |
elif len(reg_password) < 8:
|
127 |
st.error("Password must be at least 8 characters long.")
|
128 |
+
elif user_type == "Doctor" and doctor_code != st.secrets["DOCTOR_CODE"]:
|
129 |
+
st.error("Invalid doctor registration code.")
|
130 |
else:
|
131 |
hashed_password = hash_password(reg_password)
|
132 |
save_user_data(reg_username, hashed_password, user_type)
|