Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,8 +15,8 @@ def load_user_data(email):
|
|
15 |
return json.loads(file.read())
|
16 |
|
17 |
def list_saved_users():
|
18 |
-
"""List all files (users) with saved states."""
|
19 |
-
return [f[:-4] for f in os.listdir() if f.endswith('.txt')]
|
20 |
|
21 |
def main():
|
22 |
st.title('User Data Management')
|
@@ -35,11 +35,7 @@ def main():
|
|
35 |
# Input fields with emojis
|
36 |
new_email = st.text_input("π§ Email Address", value=cached_data['email'])
|
37 |
new_phone = st.text_input("π± Mobile Phone", value=cached_data['phone'])
|
38 |
-
|
39 |
-
if show_password:
|
40 |
-
new_password = st.text_input("π Password", value=cached_data['password'])
|
41 |
-
else:
|
42 |
-
new_password = st.text_input("π Password", value=cached_data['password'], type='password')
|
43 |
|
44 |
# Save data when changes are made
|
45 |
if new_email and (new_email != cached_data['email'] or new_phone != cached_data['phone'] or new_password != cached_data['password']):
|
@@ -47,8 +43,16 @@ def main():
|
|
47 |
save_user_data(new_email, cached_data)
|
48 |
st.sidebar.success("Data updated and saved!")
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
st.write("Current Data:")
|
51 |
-
st.json(
|
52 |
|
53 |
# Password Reset Simulation
|
54 |
if st.sidebar.button("Reset Password"):
|
|
|
15 |
return json.loads(file.read())
|
16 |
|
17 |
def list_saved_users():
|
18 |
+
"""List all files (users) with saved states containing '@' in filename."""
|
19 |
+
return [f[:-4] for f in os.listdir() if f.endswith('.txt') and '@' in f]
|
20 |
|
21 |
def main():
|
22 |
st.title('User Data Management')
|
|
|
35 |
# Input fields with emojis
|
36 |
new_email = st.text_input("π§ Email Address", value=cached_data['email'])
|
37 |
new_phone = st.text_input("π± Mobile Phone", value=cached_data['phone'])
|
38 |
+
new_password = st.text_input("π Password", value=cached_data['password'], type='password')
|
|
|
|
|
|
|
|
|
39 |
|
40 |
# Save data when changes are made
|
41 |
if new_email and (new_email != cached_data['email'] or new_phone != cached_data['phone'] or new_password != cached_data['password']):
|
|
|
43 |
save_user_data(new_email, cached_data)
|
44 |
st.sidebar.success("Data updated and saved!")
|
45 |
|
46 |
+
# Show email link with GET parameter
|
47 |
+
if new_email:
|
48 |
+
st.write(f"Link for this user: `http://localhost:8501/?email={new_email}`")
|
49 |
+
st.session_state['last_email'] = new_email
|
50 |
+
|
51 |
+
# Display current data without password
|
52 |
+
display_data = cached_data.copy()
|
53 |
+
display_data['password'] = '*****' # Hide the password
|
54 |
st.write("Current Data:")
|
55 |
+
st.json(display_data)
|
56 |
|
57 |
# Password Reset Simulation
|
58 |
if st.sidebar.button("Reset Password"):
|