Update login page with correct SPARKNET acronym and VISTA branding
Browse files- demo/auth.py +48 -26
demo/auth.py
CHANGED
|
@@ -82,33 +82,49 @@ def check_password() -> bool:
|
|
| 82 |
st.session_state["password_incorrect"] = True
|
| 83 |
return
|
| 84 |
|
| 85 |
-
# Get password(s) from secrets
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
username = st.session_state.get("username_input", "")
|
| 102 |
-
|
| 103 |
passwords = st.secrets["auth"]["passwords"]
|
| 104 |
-
if username in passwords
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
|
|
|
|
|
|
| 112 |
|
| 113 |
st.session_state["authenticated"] = False
|
| 114 |
st.session_state["password_incorrect"] = True
|
|
@@ -146,7 +162,13 @@ def check_password() -> bool:
|
|
| 146 |
|
| 147 |
with col2:
|
| 148 |
st.markdown('<div class="login-title">🔥 SPARKNET</div>', unsafe_allow_html=True)
|
| 149 |
-
st.markdown('<div class="login-subtitle">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
st.markdown("---")
|
| 152 |
|
|
|
|
| 82 |
st.session_state["password_incorrect"] = True
|
| 83 |
return
|
| 84 |
|
| 85 |
+
# Get password(s) from secrets - try multiple locations
|
| 86 |
+
stored_password = None
|
| 87 |
+
|
| 88 |
+
# Try auth.password first
|
| 89 |
+
try:
|
| 90 |
+
if "auth" in st.secrets and "password" in st.secrets["auth"]:
|
| 91 |
+
stored_password = str(st.secrets["auth"]["password"]).strip()
|
| 92 |
+
except Exception:
|
| 93 |
+
pass
|
| 94 |
+
|
| 95 |
+
# Fallback: try root level password
|
| 96 |
+
if not stored_password:
|
| 97 |
+
try:
|
| 98 |
+
if "password" in st.secrets:
|
| 99 |
+
stored_password = str(st.secrets["password"]).strip()
|
| 100 |
+
except Exception:
|
| 101 |
+
pass
|
| 102 |
+
|
| 103 |
+
# Check single password
|
| 104 |
+
if stored_password:
|
| 105 |
+
# Use simple comparison (strip whitespace from both)
|
| 106 |
+
if entered_password.strip() == stored_password:
|
| 107 |
+
st.session_state["authenticated"] = True
|
| 108 |
+
st.session_state["username"] = "user"
|
| 109 |
+
if "password" in st.session_state:
|
| 110 |
+
del st.session_state["password"]
|
| 111 |
+
return
|
| 112 |
+
|
| 113 |
+
# Check multiple users (auth.passwords)
|
| 114 |
+
try:
|
| 115 |
+
if "auth" in st.secrets and "passwords" in st.secrets["auth"]:
|
| 116 |
username = st.session_state.get("username_input", "")
|
|
|
|
| 117 |
passwords = st.secrets["auth"]["passwords"]
|
| 118 |
+
if username in passwords:
|
| 119 |
+
stored_user_pass = str(passwords[username]).strip()
|
| 120 |
+
if entered_password.strip() == stored_user_pass:
|
| 121 |
+
st.session_state["authenticated"] = True
|
| 122 |
+
st.session_state["username"] = username
|
| 123 |
+
if "password" in st.session_state:
|
| 124 |
+
del st.session_state["password"]
|
| 125 |
+
return
|
| 126 |
+
except Exception:
|
| 127 |
+
pass
|
| 128 |
|
| 129 |
st.session_state["authenticated"] = False
|
| 130 |
st.session_state["password_incorrect"] = True
|
|
|
|
| 162 |
|
| 163 |
with col2:
|
| 164 |
st.markdown('<div class="login-title">🔥 SPARKNET</div>', unsafe_allow_html=True)
|
| 165 |
+
st.markdown('<div class="login-subtitle">Strategic Patent Acceleration & Research Kinetics NETwork</div>', unsafe_allow_html=True)
|
| 166 |
+
st.markdown("""
|
| 167 |
+
<div style="text-align: center; color: #8b949e; font-size: 0.85em; margin: 15px 0;">
|
| 168 |
+
AI-powered Technology Transfer Office Automation<br/>
|
| 169 |
+
<span style="color: #4ECDC4;">VISTA/Horizon EU Project</span>
|
| 170 |
+
</div>
|
| 171 |
+
""", unsafe_allow_html=True)
|
| 172 |
|
| 173 |
st.markdown("---")
|
| 174 |
|