RajaThor commited on
Commit
18eac15
·
verified ·
1 Parent(s): b8418fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -34
app.py CHANGED
@@ -428,7 +428,6 @@ def tour_guide_ui():
428
  with st.expander("Buttons"):
429
  st.write("Click on these buttons to perform actions like adding a person or recognizing a face.")
430
 
431
- #streamlit interface for user login sign-up
432
  def authenticate_user_ui():
433
  # Display logo and title
434
  c30, c31, c32 = st.columns([0.2, 0.1, 3])
@@ -448,12 +447,12 @@ def authenticate_user_ui():
448
  st.title("Welcome!")
449
  main()
450
  else:
451
- option = st.sidebar.radio("Select Option", ["Login", "Sign-Up", "Reset Password"])
452
 
453
  email = st.text_input("Enter Email", help="Enter your email address")
 
454
 
455
  if option == "Login":
456
- password = st.text_input("Enter Password", type="password", help="Enter your password")
457
  if st.button("Login"):
458
  if not email or not password:
459
  st.error("Please enter both email and password.")
@@ -481,14 +480,6 @@ def authenticate_user_ui():
481
  else:
482
  st.error("User creation failed. Please try again.")
483
 
484
- elif option == "Reset Password":
485
- if st.button("Reset Password"):
486
- try:
487
- auth.generate_password_reset_link(email)
488
- st.success("Password reset link sent successfully! Please check your email.")
489
- except Exception as e:
490
- st.error(f"Failed to send password reset link: {str(e)}")
491
-
492
  # Log out user
493
  def logout():
494
  st.session_state.auth_state["user"] = None
@@ -548,31 +539,11 @@ def display_tour_steps(steps):
548
  st.markdown(f"## {step['title']}")
549
  st.write(step['content'])
550
  st.markdown("---")
551
-
552
- # start of reset password
553
- def reset_password(email):
554
- try:
555
- # Send password reset email
556
- auth.generate_password_reset_link(email)
557
- return f"Password reset email sent to {email}. Please check your inbox."
558
- except Exception as e:
559
- return f"Failed to send password reset email: {str(e)}"
560
-
561
- def reset_password_ui():
562
- st.title("Reset Password")
563
- email = st.text_input("Enter Email", help="Enter the email address for password reset")
564
- if st.button("Send Reset Email"):
565
- if not email:
566
- st.error("Please enter an email address.")
567
- else:
568
- result = reset_password(email)
569
- st.write(result)
570
- # end of reset password
571
 
572
  # Update the main function to include the feedback option
573
  def main():
574
  st.sidebar.title("Options")
575
- option = st.sidebar.radio("Select Option", ["Recognize Face", "Add Person", "Recognize Face (Optimal)", "Delete Person", "Tour Guide", "Feedback", "Messaging", "History", "Delete User", "Reset Password"])
576
 
577
  if option == "Recognize Face":
578
  recognize_face_ui()
@@ -592,8 +563,6 @@ def main():
592
  display_history(st.session_state.auth_state["user"].email)
593
  elif option == "Delete User":
594
  delete_user_ui()
595
- elif option == "Reset Password":
596
- reset_password_ui()
597
 
598
  # Run the tour guide
599
  if __name__ == "__main__":
 
428
  with st.expander("Buttons"):
429
  st.write("Click on these buttons to perform actions like adding a person or recognizing a face.")
430
 
 
431
  def authenticate_user_ui():
432
  # Display logo and title
433
  c30, c31, c32 = st.columns([0.2, 0.1, 3])
 
447
  st.title("Welcome!")
448
  main()
449
  else:
450
+ option = st.sidebar.radio("Select Option", ["Login", "Sign-Up"])
451
 
452
  email = st.text_input("Enter Email", help="Enter your email address")
453
+ password = st.text_input("Enter Password", type="password", help="Enter your password")
454
 
455
  if option == "Login":
 
456
  if st.button("Login"):
457
  if not email or not password:
458
  st.error("Please enter both email and password.")
 
480
  else:
481
  st.error("User creation failed. Please try again.")
482
 
 
 
 
 
 
 
 
 
483
  # Log out user
484
  def logout():
485
  st.session_state.auth_state["user"] = None
 
539
  st.markdown(f"## {step['title']}")
540
  st.write(step['content'])
541
  st.markdown("---")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
 
543
  # Update the main function to include the feedback option
544
  def main():
545
  st.sidebar.title("Options")
546
+ option = st.sidebar.radio("Select Option", ["Recognize Face", "Add Person", "Recognize Face (Optimal)", "Delete Person", "Tour Guide", "Feedback", "Messaging", "History", "Delete User"])
547
 
548
  if option == "Recognize Face":
549
  recognize_face_ui()
 
563
  display_history(st.session_state.auth_state["user"].email)
564
  elif option == "Delete User":
565
  delete_user_ui()
 
 
566
 
567
  # Run the tour guide
568
  if __name__ == "__main__":