ahanbose commited on
Commit
01cfb7e
Β·
verified Β·
1 Parent(s): c0f5d67

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +223 -227
src/app.py CHANGED
@@ -313,253 +313,249 @@ _PLOT_LAYOUT = dict(
313
 
314
 
315
  def render_login():
316
- """Full-screen SPJIMR branded login β€” matches the HTML login page aesthetic."""
317
 
318
- # Hide sidebar on login screen
319
  st.markdown("""
320
  <style>
321
- [data-testid="stSidebar"] { display: none !important; }
322
- [data-testid="stSidebarNav"] { display: none !important; }
323
- .stDeployButton { display: none !important; }
324
- #MainMenu { visibility: hidden; }
325
- footer { visibility: hidden; }
326
- header { visibility: hidden; }
327
- .block-container { padding: 0 !important; max-width: 100% !important; }
328
- </style>
329
- """, unsafe_allow_html=True)
330
 
331
- # ── Outer two-column split ────────────────────────────────────────────────
332
- col_brand, col_form = st.columns([11, 9], gap="small")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333
 
334
- # ── Left: Brand panel ─────────────────────────────────────────────────────
335
- with col_brand:
336
- st.markdown("""
337
- <div style="
338
- min-height: 100vh;
339
- background: linear-gradient(160deg, #1C0029 0%, #0D0014 55%, #1a0800 100%);
340
- padding: 3.5rem 3rem;
341
- position: relative;
342
- overflow: hidden;
343
- display: flex;
344
- flex-direction: column;
345
- justify-content: space-between;
346
- ">
347
-
348
- <!-- Flame lines (decorative, echoes logo) -->
349
- <svg style="position:absolute;bottom:-40px;left:-10px;width:320px;height:500px;opacity:0.07;pointer-events:none;"
350
- viewBox="0 0 320 500" fill="none" xmlns="http://www.w3.org/2000/svg">
351
- <path d="M10 500 Q50 290 90 70" stroke="#F67D31" stroke-width="28" stroke-linecap="round"/>
352
- <path d="M65 500 Q115 290 155 50" stroke="#F67D31" stroke-width="22" stroke-linecap="round"/>
353
- <path d="M125 500 Q185 300 225 40" stroke="#F67D31" stroke-width="16" stroke-linecap="round"/>
354
- <path d="M190 500 Q248 320 292 70" stroke="#F67D31" stroke-width="10" stroke-linecap="round"/>
355
- </svg>
356
-
357
- <!-- Radial glow -->
358
- <div style="position:absolute;bottom:0;left:0;width:400px;height:400px;
359
- background:radial-gradient(ellipse at 20% 100%, rgba(246,125,49,0.14) 0%, transparent 60%);
360
- pointer-events:none;"></div>
361
-
362
- <!-- Logo -->
363
- <div>
364
- <div style="display:flex;align-items:flex-end;gap:16px;margin-bottom:2.8rem;">
365
- <svg width="46" height="54" viewBox="0 0 46 54" fill="none" xmlns="http://www.w3.org/2000/svg">
366
- <path d="M5 54 Q10 35 18 15 Q22 4 28 0 Q23 15 30 23 Q32 11 40 3 Q38 19 42 27 Q46 36 42 46 Q38 54 30 54"
367
- fill="none" stroke="#F67D31" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round"/>
368
- <path d="M9 54 Q14 37 22 22 Q26 11 32 5 Q28 19 34 27 Q36 17 42 9"
369
- fill="none" stroke="#F67D31" stroke-width="2.5" stroke-linecap="round" opacity="0.55"/>
370
- <path d="M17 54 Q22 38 28 26 Q30 20 36 14"
371
- fill="none" stroke="#F67D31" stroke-width="2" stroke-linecap="round" opacity="0.35"/>
372
- </svg>
373
- <div>
374
- <div style="font-size:12px;font-weight:300;letter-spacing:0.05em;color:rgba(255,255,255,0.6);margin-bottom:3px;">
375
- Bharatiya Vidya Bhavan's
376
- </div>
377
- <div style="font-size:34px;font-weight:500;line-height:1;letter-spacing:-0.01em;">
378
- <span style="color:#F67D31;">SP</span><span style="color:white;">JIMR</span>
379
- </div>
380
- </div>
381
- </div>
382
 
383
- <h1 style="
384
- font-family: 'Cormorant Garamond', serif;
385
- font-size: 3.2rem;
386
- font-weight: 300;
387
- line-height: 1.12;
388
- color: white;
389
- letter-spacing: -0.01em;
390
- max-width: 420px;
391
- margin-bottom: 1.4rem;
392
- ">
393
- Where <em style="font-style:italic;color:#FFA066;">purpose</em><br>
394
- meets<br>
395
- management.
396
- </h1>
397
-
398
- <p style="font-size:14px;font-weight:300;line-height:1.75;color:rgba(255,255,255,0.5);max-width:360px;">
399
- S.P. Jain Institute of Management and Research β€” ranked among India's finest
400
- business schools, shaping responsible leaders for a complex world.
401
- </p>
402
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
 
404
- <!-- Stat strip -->
405
- <div style="display:flex;gap:2.5rem;padding-top:2rem;border-top:1px solid rgba(255,255,255,0.1);">
406
- <div>
407
- <div style="font-family:'Cormorant Garamond',serif;font-size:2rem;font-weight:600;color:#F67D31;line-height:1;">62+</div>
408
- <div style="font-size:11px;color:rgba(255,255,255,0.4);letter-spacing:0.06em;text-transform:uppercase;margin-top:4px;">Years of excellence</div>
409
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
  <div>
411
- <div style="font-family:'Cormorant Garamond',serif;font-size:2rem;font-weight:600;color:#F67D31;line-height:1;">10K+</div>
412
- <div style="font-size:11px;color:rgba(255,255,255,0.4);letter-spacing:0.06em;text-transform:uppercase;margin-top:4px;">Alumni worldwide</div>
413
- </div>
414
- <div>
415
- <div style="font-family:'Cormorant Garamond',serif;font-size:2rem;font-weight:600;color:#F67D31;line-height:1;">#1</div>
416
- <div style="font-size:11px;color:rgba(255,255,255,0.4);letter-spacing:0.06em;text-transform:uppercase;margin-top:4px;">Social impact</div>
 
417
  </div>
418
  </div>
419
-
 
 
 
420
  </div>
421
- """, unsafe_allow_html=True)
422
-
423
- # ── Right: Login form ─────────────────────────────────────────────────────
424
- with col_form:
425
- st.markdown("""
426
- <div style="min-height:100vh;display:flex;flex-direction:column;
427
- justify-content:center;padding:3rem 3rem 3rem 2.5rem;
428
- background:#120018;">
429
- """, unsafe_allow_html=True)
430
-
431
- # Tag
432
- st.markdown("""
433
- <div style="display:inline-flex;align-items:center;gap:6px;
434
- background:rgba(246,125,49,0.12);color:#F67D31;
435
- font-size:11px;font-weight:500;letter-spacing:0.05em;text-transform:uppercase;
436
- padding:5px 14px;border-radius:100px;margin-bottom:1rem;">
437
- <span style="width:6px;height:6px;border-radius:50%;background:#F67D31;display:inline-block;"></span>
438
- ESG Sustainability Platform
439
  </div>
440
- """, unsafe_allow_html=True)
441
-
442
- st.markdown("""
443
- <div style="font-family:'Cormorant Garamond',serif;font-size:2.1rem;
444
- font-weight:400;color:white;line-height:1.15;margin-bottom:0.4rem;">
445
- Welcome back
446
  </div>
447
- <div style="font-size:14px;color:rgba(196,164,212,0.8);font-weight:300;
448
- line-height:1.6;margin-bottom:2rem;">
449
- Sign in to access your sustainability dashboard and insights.
 
450
  </div>
451
- """, unsafe_allow_html=True)
452
-
453
- # ── Inline form style overrides ───────────────────────────────────────
454
- st.markdown("""
455
- <style>
456
- div[data-testid="stForm"] {
457
- background: transparent !important;
458
- border: none !important;
459
- padding: 0 !important;
460
- }
461
- div[data-testid="stForm"] .stTextInput input {
462
- height: 48px !important;
463
- border-radius: 10px !important;
464
- border: 1.5px solid rgba(80,0,115,0.5) !important;
465
- background: rgba(255,255,255,0.04) !important;
466
- color: #FDF5FF !important;
467
- font-size: 14px !important;
468
- padding-left: 16px !important;
469
- }
470
- div[data-testid="stForm"] .stTextInput input:focus {
471
- border-color: #F67D31 !important;
472
- box-shadow: 0 0 0 3px rgba(246,125,49,0.12) !important;
473
- }
474
- div[data-testid="stForm"] .stTextInput label {
475
- font-size: 11px !important;
476
- font-weight: 500 !important;
477
- letter-spacing: 0.05em !important;
478
- text-transform: uppercase !important;
479
- color: #FDF5FF !important;
480
- margin-bottom: 6px !important;
481
- }
482
- div[data-testid="stForm"] .stFormSubmitButton button {
483
- width: 100% !important;
484
- height: 52px !important;
485
- background: #500073 !important;
486
- color: white !important;
487
- border: none !important;
488
- border-radius: 10px !important;
489
- font-size: 15px !important;
490
- font-weight: 500 !important;
491
- letter-spacing: 0.03em !important;
492
- margin-top: 0.5rem !important;
493
- transition: background 0.2s !important;
494
- }
495
- div[data-testid="stForm"] .stFormSubmitButton button:hover {
496
- background: #6b009a !important;
497
- box-shadow: 0 0 18px rgba(246,125,49,0.2) !important;
498
- }
499
- </style>
500
- """, unsafe_allow_html=True)
501
-
502
- # Error placeholder
503
- err_slot = st.empty()
504
-
505
- with st.form("login_form", clear_on_submit=False):
506
- email_val = st.text_input("Email address", placeholder="yourname@spjimr.org",
507
- key="login_email_input")
508
- pass_val = st.text_input("Password", type="password",
509
- placeholder="Enter your password",
510
- key="login_pass_input")
511
-
512
- # Remember me + forgot
513
- rc, fc = st.columns([1, 1])
514
- with rc:
515
- st.markdown('<span style="font-size:13px;color:#C4A4D4;">Remember me</span>',
516
- unsafe_allow_html=True)
517
- remember = st.checkbox("", key="login_remember", label_visibility="collapsed")
518
- with fc:
519
- st.markdown(
520
- '<div style="text-align:right;padding-top:4px;">'
521
- '<a href="#" style="font-size:13px;color:#F67D31;text-decoration:none;font-weight:500;">'
522
- 'Forgot password?</a></div>',
523
- unsafe_allow_html=True,
524
- )
525
-
526
- submitted = st.form_submit_button("Sign in β†’")
527
-
528
- if submitted:
529
- _app_password = os.getenv("APP_PASSWORD")
530
- if not _app_password:
531
- err_slot.error("βš™οΈ APP_PASSWORD secret is not configured. Add it in HuggingFace Space settings.")
532
- elif not email_val or not email_val.lower().endswith("@spjimr.org"):
533
- err_slot.error("Access restricted to SPJIMR email addresses (@spjimr.org).")
534
- elif pass_val != _app_password:
535
- err_slot.error("Incorrect password. Please try again.")
536
- else:
537
- st.session_state["logged_in"] = True
538
- st.session_state["login_user"] = email_val.lower()
539
- st.rerun()
540
 
541
- # Divider + SSO
542
- st.markdown("""
543
- <div style="display:flex;align-items:center;gap:12px;margin:1.4rem 0;">
544
- <div style="flex:1;height:1px;background:rgba(80,0,115,0.4);"></div>
545
- <span style="font-size:12px;color:rgba(196,164,212,0.6);">or continue with</span>
546
- <div style="flex:1;height:1px;background:rgba(80,0,115,0.4);"></div>
547
- </div>
548
- """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
549
 
550
- if st.button(" πŸ” SPJIMR Single Sign-On (SSO)", use_container_width=True, key="sso_btn"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
551
  st.session_state["logged_in"] = True
552
- st.session_state["login_user"] = "sso_user@spjimr.org"
553
  st.rerun()
554
 
555
- st.markdown("""
556
- <div style="margin-top:1.8rem;text-align:center;font-size:12px;color:rgba(196,164,212,0.6);line-height:1.8;">
557
- New to the platform? <a href="#" style="color:#F67D31;text-decoration:none;font-weight:500;">Request access</a><br>
558
- Having trouble? <a href="#" style="color:#F67D31;text-decoration:none;font-weight:500;">Contact IT support</a>
559
- </div>
560
- """, unsafe_allow_html=True)
 
561
 
562
- st.markdown("</div>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
563
 
564
 
565
  # ═══════════════════════════════════════════════════════════════════════════════
 
313
 
314
 
315
  def render_login():
316
+ """Full-screen SPJIMR branded login - fixed left brand panel, Streamlit form on right."""
317
 
 
318
  st.markdown("""
319
  <style>
320
+ @import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300&family=DM+Sans:wght@300;400;500&display=swap');
 
 
 
 
 
 
 
 
321
 
322
+ [data-testid="stSidebar"] { display: none !important; }
323
+ [data-testid="stSidebarNav"] { display: none !important; }
324
+ .stDeployButton { display: none !important; }
325
+ #MainMenu { visibility: hidden; }
326
+ footer { visibility: hidden; }
327
+ header { visibility: hidden; }
328
+
329
+ html, body { height: 100%; background: #120018 !important; }
330
+
331
+ .main .block-container {
332
+ padding: 0 !important;
333
+ margin: 0 !important;
334
+ max-width: 100% !important;
335
+ padding-left: 54% !important;
336
+ padding-right: 3rem !important;
337
+ padding-top: 0 !important;
338
+ padding-bottom: 0 !important;
339
+ min-height: 100vh;
340
+ display: flex;
341
+ flex-direction: column;
342
+ justify-content: center;
343
+ background: #120018;
344
+ box-sizing: border-box;
345
+ }
346
 
347
+ .spjimr-brand-panel {
348
+ position: fixed;
349
+ top: 0; left: 0;
350
+ width: 52%;
351
+ height: 100vh;
352
+ background: linear-gradient(160deg, #1C0029 0%, #0D0014 55%, #150008 100%);
353
+ border-right: 1px solid rgba(80,0,115,0.4);
354
+ display: flex;
355
+ flex-direction: column;
356
+ justify-content: space-between;
357
+ padding: 3.5rem 3rem;
358
+ overflow: hidden;
359
+ z-index: 999;
360
+ box-sizing: border-box;
361
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
362
 
363
+ div[data-testid="stForm"] {
364
+ background: transparent !important;
365
+ border: none !important;
366
+ padding: 0 !important;
367
+ }
368
+ div[data-testid="stForm"] .stTextInput input {
369
+ height: 48px !important;
370
+ border-radius: 10px !important;
371
+ border: 1.5px solid rgba(80,0,115,0.5) !important;
372
+ background: rgba(255,255,255,0.05) !important;
373
+ color: #FDF5FF !important;
374
+ font-size: 14px !important;
375
+ }
376
+ div[data-testid="stForm"] .stTextInput input:focus {
377
+ border-color: #F67D31 !important;
378
+ box-shadow: 0 0 0 3px rgba(246,125,49,0.12) !important;
379
+ }
380
+ div[data-testid="stForm"] .stTextInput label {
381
+ font-size: 11px !important;
382
+ font-weight: 500 !important;
383
+ letter-spacing: 0.05em !important;
384
+ text-transform: uppercase !important;
385
+ color: #FDF5FF !important;
386
+ }
387
+ div[data-testid="stForm"] .stFormSubmitButton button {
388
+ width: 100% !important;
389
+ height: 52px !important;
390
+ background: #500073 !important;
391
+ color: white !important;
392
+ border: none !important;
393
+ border-radius: 10px !important;
394
+ font-size: 15px !important;
395
+ font-weight: 500 !important;
396
+ letter-spacing: 0.03em !important;
397
+ margin-top: 0.5rem !important;
398
+ }
399
+ div[data-testid="stForm"] .stFormSubmitButton button:hover {
400
+ background: #6b009a !important;
401
+ box-shadow: 0 0 18px rgba(246,125,49,0.2) !important;
402
+ }
403
+ .stButton > button {
404
+ width: 100% !important;
405
+ height: 48px !important;
406
+ background: rgba(255,255,255,0.04) !important;
407
+ color: #FDF5FF !important;
408
+ border: 1.5px solid rgba(80,0,115,0.5) !important;
409
+ border-radius: 10px !important;
410
+ font-size: 14px !important;
411
+ font-weight: 400 !important;
412
+ }
413
+ .stButton > button:hover {
414
+ border-color: #F67D31 !important;
415
+ background: rgba(246,125,49,0.06) !important;
416
+ box-shadow: none !important;
417
+ color: #FDF5FF !important;
418
+ }
419
+ </style>
420
 
421
+ <div class="spjimr-brand-panel">
422
+ <svg style="position:absolute;bottom:-40px;left:-10px;width:320px;height:500px;opacity:0.07;pointer-events:none;"
423
+ viewBox="0 0 320 500" fill="none">
424
+ <path d="M10 500 Q50 290 90 70" stroke="#F67D31" stroke-width="28" stroke-linecap="round"/>
425
+ <path d="M65 500 Q115 290 155 50" stroke="#F67D31" stroke-width="22" stroke-linecap="round"/>
426
+ <path d="M125 500 Q185 300 225 40" stroke="#F67D31" stroke-width="16" stroke-linecap="round"/>
427
+ <path d="M190 500 Q248 320 292 70" stroke="#F67D31" stroke-width="10" stroke-linecap="round"/>
428
+ </svg>
429
+ <div style="position:absolute;bottom:0;left:0;width:400px;height:400px;
430
+ background:radial-gradient(ellipse at 20% 100%,rgba(246,125,49,0.14) 0%,transparent 60%);
431
+ pointer-events:none;"></div>
432
+ <div style="position:relative;z-index:2;">
433
+ <div style="display:flex;align-items:flex-end;gap:16px;margin-bottom:2.4rem;">
434
+ <svg width="44" height="52" viewBox="0 0 46 54" fill="none">
435
+ <path d="M5 54 Q10 35 18 15 Q22 4 28 0 Q23 15 30 23 Q32 11 40 3 Q38 19 42 27 Q46 36 42 46 Q38 54 30 54"
436
+ fill="none" stroke="#F67D31" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round"/>
437
+ <path d="M9 54 Q14 37 22 22 Q26 11 32 5 Q28 19 34 27 Q36 17 42 9"
438
+ fill="none" stroke="#F67D31" stroke-width="2.5" stroke-linecap="round" opacity="0.55"/>
439
+ <path d="M17 54 Q22 38 28 26 Q30 20 36 14"
440
+ fill="none" stroke="#F67D31" stroke-width="2" stroke-linecap="round" opacity="0.35"/>
441
+ </svg>
442
  <div>
443
+ <div style="font-family:'DM Sans',sans-serif;font-size:12px;font-weight:300;
444
+ letter-spacing:0.05em;color:rgba(255,255,255,0.6);margin-bottom:3px;">
445
+ Bharatiya Vidya Bhavan's
446
+ </div>
447
+ <div style="font-family:'DM Sans',sans-serif;font-size:32px;font-weight:500;line-height:1;">
448
+ <span style="color:#F67D31;">SP</span><span style="color:white;">JIMR</span>
449
+ </div>
450
  </div>
451
  </div>
452
+ <div style="font-family:'Cormorant Garamond',serif;font-size:clamp(1.8rem,2.8vw,3rem);
453
+ font-weight:300;line-height:1.12;color:white;margin-bottom:1.2rem;">
454
+ Where <em style="font-style:italic;color:#FFA066;">purpose</em><br>
455
+ meets<br>management.
456
  </div>
457
+ <p style="font-family:'DM Sans',sans-serif;font-size:14px;font-weight:300;
458
+ line-height:1.75;color:rgba(255,255,255,0.5);max-width:340px;">
459
+ S.P. Jain Institute of Management and Research β€” shaping responsible leaders
460
+ for a complex world.
461
+ </p>
462
+ </div>
463
+ <div style="position:relative;z-index:2;display:flex;gap:2.5rem;
464
+ padding-top:1.8rem;border-top:1px solid rgba(255,255,255,0.1);">
465
+ <div>
466
+ <div style="font-family:'Cormorant Garamond',serif;font-size:1.9rem;font-weight:600;color:#F67D31;line-height:1;">62+</div>
467
+ <div style="font-family:'DM Sans',sans-serif;font-size:10px;color:rgba(255,255,255,0.4);
468
+ letter-spacing:0.06em;text-transform:uppercase;margin-top:3px;">Years of excellence</div>
 
 
 
 
 
 
469
  </div>
470
+ <div>
471
+ <div style="font-family:'Cormorant Garamond',serif;font-size:1.9rem;font-weight:600;color:#F67D31;line-height:1;">10K+</div>
472
+ <div style="font-family:'DM Sans',sans-serif;font-size:10px;color:rgba(255,255,255,0.4);
473
+ letter-spacing:0.06em;text-transform:uppercase;margin-top:3px;">Alumni worldwide</div>
 
 
474
  </div>
475
+ <div>
476
+ <div style="font-family:'Cormorant Garamond',serif;font-size:1.9rem;font-weight:600;color:#F67D31;line-height:1;">#1</div>
477
+ <div style="font-family:'DM Sans',sans-serif;font-size:10px;color:rgba(255,255,255,0.4);
478
+ letter-spacing:0.06em;text-transform:uppercase;margin-top:3px;">Social impact</div>
479
  </div>
480
+ </div>
481
+ </div>
482
+ """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
 
484
+ # Right side form
485
+ st.markdown("""
486
+ <div style="display:inline-flex;align-items:center;gap:6px;
487
+ background:rgba(246,125,49,0.12);color:#F67D31;
488
+ font-family:'DM Sans',sans-serif;font-size:11px;font-weight:500;
489
+ letter-spacing:0.05em;text-transform:uppercase;
490
+ padding:5px 14px;border-radius:100px;margin-bottom:0.8rem;">
491
+ <span style="width:6px;height:6px;border-radius:50%;background:#F67D31;display:inline-block;flex-shrink:0;"></span>
492
+ ESG Sustainability Platform
493
+ </div>
494
+ <div style="font-family:'Cormorant Garamond',serif;font-size:2rem;
495
+ font-weight:400;color:white;line-height:1.15;margin-bottom:0.3rem;">
496
+ Welcome back
497
+ </div>
498
+ <div style="font-family:'DM Sans',sans-serif;font-size:13px;
499
+ color:rgba(196,164,212,0.8);font-weight:300;line-height:1.6;margin-bottom:1.5rem;">
500
+ Sign in with your SPJIMR email to continue.
501
+ </div>
502
+ """, unsafe_allow_html=True)
503
 
504
+ err_slot = st.empty()
505
+
506
+ with st.form("login_form", clear_on_submit=False):
507
+ email_val = st.text_input("Email address", placeholder="yourname@spjimr.org",
508
+ key="login_email_input")
509
+ pass_val = st.text_input("Password", type="password",
510
+ placeholder="Enter your password",
511
+ key="login_pass_input")
512
+ rc, fc = st.columns([1, 1])
513
+ with rc:
514
+ st.checkbox("Remember me", key="login_remember")
515
+ with fc:
516
+ st.markdown(
517
+ '<div style="text-align:right;padding-top:6px;">'
518
+ '<a href="#" style="font-size:12px;color:#F67D31;text-decoration:none;font-weight:500;">'
519
+ 'Forgot password?</a></div>',
520
+ unsafe_allow_html=True,
521
+ )
522
+ submitted = st.form_submit_button("Sign in β†’")
523
+
524
+ if submitted:
525
+ _app_password = os.getenv("APP_PASSWORD")
526
+ if not _app_password:
527
+ err_slot.error("βš™οΈ APP_PASSWORD secret is not configured. Add it in HuggingFace Space settings.")
528
+ elif not email_val or not email_val.lower().endswith("@spjimr.org"):
529
+ err_slot.error("Access restricted to SPJIMR email addresses (@spjimr.org).")
530
+ elif pass_val != _app_password:
531
+ err_slot.error("Incorrect password. Please try again.")
532
+ else:
533
  st.session_state["logged_in"] = True
534
+ st.session_state["login_user"] = email_val.lower()
535
  st.rerun()
536
 
537
+ st.markdown("""
538
+ <div style="display:flex;align-items:center;gap:12px;margin:1.2rem 0;">
539
+ <div style="flex:1;height:1px;background:rgba(80,0,115,0.4);"></div>
540
+ <span style="font-family:'DM Sans',sans-serif;font-size:12px;color:rgba(196,164,212,0.5);">or continue with</span>
541
+ <div style="flex:1;height:1px;background:rgba(80,0,115,0.4);"></div>
542
+ </div>
543
+ """, unsafe_allow_html=True)
544
 
545
+ if st.button("πŸ” SPJIMR Single Sign-On (SSO)", use_container_width=True, key="sso_btn"):
546
+ st.session_state["logged_in"] = True
547
+ st.session_state["login_user"] = "sso_user@spjimr.org"
548
+ st.rerun()
549
+
550
+ st.markdown("""
551
+ <div style="margin-top:1.5rem;text-align:center;font-family:'DM Sans',sans-serif;
552
+ font-size:12px;color:rgba(196,164,212,0.5);line-height:1.9;">
553
+ New to the platform?
554
+ <a href="#" style="color:#F67D31;text-decoration:none;font-weight:500;">Request access</a><br>
555
+ Having trouble?
556
+ <a href="#" style="color:#F67D31;text-decoration:none;font-weight:500;">Contact IT support</a>
557
+ </div>
558
+ """, unsafe_allow_html=True)
559
 
560
 
561
  # ═══════════════════════════════════════════════════════════════════════════════