Menixis Claude Opus 4.8 (1M context) commited on
Commit
ea6ec06
·
1 Parent(s): c6994c8

Auto-form: declutter the login card (remove redundant text)

Browse files

Drop the two description lines, the Entra-ID/'เฉพาะบัญชีองค์กร' footer badges, and the
'ปุ่มไม่ทำงาน? เปิดแบบเต็มหน้าจอ' hint, plus their orphaned CSS. Login card is now just
header + lock + 'เข้าสู่ระบบ' + the Microsoft button.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. auth_gate.py +2 -56
auth_gate.py CHANGED
@@ -79,28 +79,12 @@ _LOGIN_CSS = """
79
  }
80
  .login-title {
81
  font-size: 1.55rem; font-weight: 800; color: #F5F3F1;
82
- margin: 0 0 0.4rem; letter-spacing: -0.01em;
83
- }
84
- .login-sub {
85
- font-size: 0.92rem; line-height: 1.6; margin: 0;
86
- color: #9A8F86 !important;
87
  }
88
 
89
  /* ── CTA button: give it side gutters since the card has no padding ── */
90
  .st-key-login_card [data-testid="stButton"] { padding: 0.5rem 1.7rem 0.15rem; }
91
 
92
- /* ── Footer security lockup ── */
93
- .login-foot {
94
- display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
95
- padding: 0.7rem 1.4rem 1.6rem; text-align: center;
96
- }
97
- .login-foot-ms {
98
- display: inline-flex; align-items: center; gap: 0.42rem;
99
- font-size: 0.74rem; font-weight: 600;
100
- color: #A89C92 !important;
101
- }
102
- .login-foot-note { font-size: 0.68rem; color: #7C726A !important; }
103
-
104
  /* Shown when no auth provider is configured (graceful instead of a crash) */
105
  .login-warn {
106
  margin: 0.2rem 1.7rem 0.2rem; padding: 0.75rem 0.9rem;
@@ -111,13 +95,6 @@ _LOGIN_CSS = """
111
  text-align: center; line-height: 1.5;
112
  }
113
 
114
- /* Escape hatch for the embedded (iframe) case */
115
- .login-altlink {
116
- margin: 0.5rem 1.7rem 0; text-align: center;
117
- font-size: 0.72rem; color: #928981;
118
- }
119
- .login-altlink a { color: #F2B391 !important; text-decoration: underline; }
120
-
121
  @keyframes loginRise {
122
  from { opacity: 0; transform: translateY(22px) scale(0.985); }
123
  to { opacity: 1; transform: none; }
@@ -186,10 +163,6 @@ def require_login() -> None:
186
  </svg>
187
  </div>
188
  <div class="login-title">เข้าสู่ระบบ</div>
189
- <p class="login-sub">
190
- ลงชื่อเข้าใช้ด้วยบัญชี PTT<br>
191
- เพื่อสร้างและดาวน์โหลดเอกสาร
192
- </p>
193
  </div>
194
  """,
195
  unsafe_allow_html=True,
@@ -203,40 +176,13 @@ def require_login() -> None:
203
  except Exception:
204
  st.error("ไม่สามารถเริ่มการเข้าสู่ระบบได้ "
205
  "กรุณาลองใหม่หรือติดต่อผู้ดูแลระบบ")
206
- # When opened embedded (the HF Space page runs the app in an iframe),
207
- # st.login()'s redirect is blocked by Microsoft's frame-busting and
208
- # "nothing happens". This escape hatch reopens the app top-level in a
209
- # new tab (href="/" is host-agnostic) where sign-in works.
210
- st.markdown(
211
- "<div class='login-altlink'>ปุ่มไม่ทำงาน? "
212
- "<a href='/' target='_blank' rel='noopener'>เปิดแบบเต็มหน้าจอ</a>"
213
- " แล้วลองอีกครั้ง</div>",
214
- unsafe_allow_html=True,
215
- )
216
  else:
217
  st.markdown(
218
  "<div class='login-warn'>⚠ ระบบเข้าสู่ระบบยังไม่ถูกตั้งค่า<br>"
219
  "กรุณาติดต่อผู้ดูแลระบบ</div>",
220
  unsafe_allow_html=True,
221
  )
222
-
223
- st.markdown(
224
- """
225
- <div class="login-foot">
226
- <div class="login-foot-ms">
227
- <svg width="15" height="15" viewBox="0 0 23 23" aria-hidden="true">
228
- <rect width="10" height="10" x="1" y="1" fill="#F25022"></rect>
229
- <rect width="10" height="10" x="12" y="1" fill="#7FBA00"></rect>
230
- <rect width="10" height="10" x="1" y="12" fill="#00A4EF"></rect>
231
- <rect width="10" height="10" x="12" y="12" fill="#FFB900"></rect>
232
- </svg>
233
- <span>ปลอดภัยด้วย Microsoft Entra ID</span>
234
- </div>
235
- <div class="login-foot-note">เฉพาะบัญชีองค์กรที่ได้รับอนุญาต</div>
236
- </div>
237
- """,
238
- unsafe_allow_html=True,
239
- )
240
 
241
  st.stop()
242
 
 
79
  }
80
  .login-title {
81
  font-size: 1.55rem; font-weight: 800; color: #F5F3F1;
82
+ margin: 0; letter-spacing: -0.01em;
 
 
 
 
83
  }
84
 
85
  /* ── CTA button: give it side gutters since the card has no padding ── */
86
  .st-key-login_card [data-testid="stButton"] { padding: 0.5rem 1.7rem 0.15rem; }
87
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  /* Shown when no auth provider is configured (graceful instead of a crash) */
89
  .login-warn {
90
  margin: 0.2rem 1.7rem 0.2rem; padding: 0.75rem 0.9rem;
 
95
  text-align: center; line-height: 1.5;
96
  }
97
 
 
 
 
 
 
 
 
98
  @keyframes loginRise {
99
  from { opacity: 0; transform: translateY(22px) scale(0.985); }
100
  to { opacity: 1; transform: none; }
 
163
  </svg>
164
  </div>
165
  <div class="login-title">เข้าสู่ระบบ</div>
 
 
 
 
166
  </div>
167
  """,
168
  unsafe_allow_html=True,
 
176
  except Exception:
177
  st.error("ไม่สามารถเริ่มการเข้าสู่ระบบได้ "
178
  "กรุณาลองใหม่หรือติดต่อผู้ดูแลระบบ")
 
 
 
 
 
 
 
 
 
 
179
  else:
180
  st.markdown(
181
  "<div class='login-warn'>⚠ ระบบเข้าสู่ระบบยังไม่ถูกตั้งค่า<br>"
182
  "กรุณาติดต่อผู้ดูแลระบบ</div>",
183
  unsafe_allow_html=True,
184
  )
185
+ st.markdown("<div style='height:1.2rem'></div>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
 
187
  st.stop()
188