Commit ·
157e0f8
1
Parent(s): 8e17e8f
Improve login UI design - cleaner, centered layout
Browse files- src/Start_Page.py +8 -6
- src/gui_elements/session_cache.py +2 -2
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 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
| 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 |
-
|
|
|
|
| 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.")
|