awacke1 commited on
Commit
9e08ba2
Β·
verified Β·
1 Parent(s): b4ca662

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
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
- show_password = st.checkbox("Show password")
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(cached_data)
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"):