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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -45
app.py CHANGED
@@ -376,54 +376,28 @@ def authenticate_user_ui():
376
  main()
377
  else:
378
  st.error("Authentication failed. Please check your email and password.")
379
-
380
  elif tabs == "Sign-Up":
381
- email = st.text_input("Enter Email", help="Enter your email address")
382
- password = st.text_input("Enter Password", type="password", help="Enter your password")
383
- confirm_password = st.text_input("Confirm Password", type="password", help="Re-enter your password for confirmation")
384
-
385
- if st.button("Sign-Up"):
386
- if not email or not password or not confirm_password:
387
- st.error("Please fill all the fields.")
388
- elif password != confirm_password:
389
- st.error("Passwords do not match.")
390
- else:
391
- success, uid = create_user(email, password)
392
- if success:
393
- st.success(f"User with UID: {uid} created successfully! You can now log in.")
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():
 
376
  main()
377
  else:
378
  st.error("Authentication failed. Please check your email and password.")
379
+
380
  elif tabs == "Sign-Up":
381
+ if st.session_state.auth_state["signed_in"]:
382
+ st.sidebar.button("Sign Out", on_click=logout)
383
+ st.title("Welcome!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  main()
385
  else:
386
+ email = st.text_input("Enter Email", help="Enter your email address")
387
+ password = st.text_input("Enter Password", type="password", help="Enter your password")
388
+ confirm_password = st.text_input("Confirm Password", type="password", help="Re-enter your password for confirmation")
389
+
390
+ if st.button("Sign-Up"):
391
+ if not email or not password or not confirm_password:
392
+ st.error("Please fill all the fields.")
393
+ elif password != confirm_password:
394
+ st.error("Passwords do not match.")
395
+ else:
396
+ success, uid = create_user(email, password)
397
+ if success:
398
+ st.success(f"User with UID: {uid} created successfully! You can now log in.")
399
+ else:
400
+ st.error("User creation failed. Please try again.")
401
 
402
  # Log out user
403
  def logout():