RajaThor commited on
Commit
4debce0
·
verified ·
1 Parent(s): 87f64fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py CHANGED
@@ -394,6 +394,37 @@ def authenticate_user_ui():
394
  else:
395
  st.error("User creation failed. Please try again.")
396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  # Log out user
398
  def logout():
399
  st.session_state.auth_state["user"] = None
 
394
  else:
395
  st.error("User creation failed. Please try again.")
396
 
397
+ # Move the form rendering code outside the if blocks
398
+ # This ensures that the forms are always displayed
399
+ email = st.text_input("Enter Email", help="Enter your email address")
400
+ password = st.text_input("Enter Password", type="password", help="Enter your password")
401
+ confirm_password = st.text_input("Confirm Password", type="password", help="Re-enter your password for confirmation")
402
+
403
+ if st.button("Login"):
404
+ if not email or not password:
405
+ st.error("Please enter both email and password.")
406
+ else:
407
+ success, user = authenticate_user(email, password)
408
+ if success:
409
+ st.session_state.auth_state["user"] = user
410
+ st.session_state.auth_state["signed_in"] = True
411
+ st.success("Authentication successful! You can now manage your set of images and profiles.")
412
+ main()
413
+ else:
414
+ st.error("Authentication failed. Please check your email and password.")
415
+
416
+ if st.button("Sign-Up"):
417
+ if not email or not password or not confirm_password:
418
+ st.error("Please fill all the fields.")
419
+ elif password != confirm_password:
420
+ st.error("Passwords do not match.")
421
+ else:
422
+ success, uid = create_user(email, password)
423
+ if success:
424
+ st.success(f"User with UID: {uid} created successfully! You can now log in.")
425
+ else:
426
+ st.error("User creation failed. Please try again.")
427
+
428
  # Log out user
429
  def logout():
430
  st.session_state.auth_state["user"] = None