AhmedASalem commited on
Commit
157e0f8
·
1 Parent(s): 8e17e8f

Improve login UI design - cleaner, centered layout

Browse files
src/Start_Page.py CHANGED
@@ -26,12 +26,14 @@ handle_oauth_callback()
26
  # Check if login is required (for Hugging Face Spaces)
27
  login_required, login_error_message = require_hf_login()
28
  if login_required:
29
- st.error(login_error_message)
30
- st.info("💡 **Tip:** Click the button below to sign in with your Hugging Face account.")
31
- st.divider()
32
- login_button() # Show the login button
33
- st.divider()
34
- st.info("**Note:** You need to complete the OAuth flow within this app, even if you're already logged into Hugging Face in your browser.")
 
 
35
  st.stop() # Stop execution - user must log in
36
 
37
  # User is logged in - show username (optional)
 
26
  # Check if login is required (for Hugging Face Spaces)
27
  login_required, login_error_message = require_hf_login()
28
  if login_required:
29
+ # Center the login UI in a container
30
+ col1, col2, col3 = st.columns([1, 2, 1])
31
+ with col2:
32
+ with st.container(border=True):
33
+ st.markdown("### 🔐 Sign In Required")
34
+ st.markdown("This application requires Hugging Face authentication to provide personalized session management.")
35
+ st.markdown("")
36
+ login_button()
37
  st.stop() # Stop execution - user must log in
38
 
39
  # User is logged in - show username (optional)
src/gui_elements/session_cache.py CHANGED
@@ -34,7 +34,6 @@ def login_button():
34
  """Display a login button that redirects to HF OAuth."""
35
  if not os.environ.get("OAUTH_CLIENT_ID"):
36
  st.error("OAuth is not configured. Please enable hf_oauth: true in README.md")
37
- st.info("The Space needs to be rebuilt after adding hf_oauth: true to README.md")
38
  return
39
 
40
  try:
@@ -64,7 +63,8 @@ def login_button():
64
  "state": state,
65
  }
66
  url = auth_endpoint + "?" + urllib.parse.urlencode(params)
67
- st.link_button("🔐 Sign in with Hugging Face", url, use_container_width=True)
 
68
  except Exception as e:
69
  st.error(f"Error setting up OAuth login: {e}")
70
  st.info("Please check the Space logs for more details.")
 
34
  """Display a login button that redirects to HF OAuth."""
35
  if not os.environ.get("OAUTH_CLIENT_ID"):
36
  st.error("OAuth is not configured. Please enable hf_oauth: true in README.md")
 
37
  return
38
 
39
  try:
 
63
  "state": state,
64
  }
65
  url = auth_endpoint + "?" + urllib.parse.urlencode(params)
66
+ # Make button larger and more prominent
67
+ st.link_button("🔐 Sign in with Hugging Face", url, use_container_width=True, type="primary")
68
  except Exception as e:
69
  st.error(f"Error setting up OAuth login: {e}")
70
  st.info("Please check the Space logs for more details.")