diff --git a/app/static/css/style.css b/app/static/css/style.css index fb41736..6c1f7ca 100644 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -607,6 +607,44 @@ textarea:focus { margin-bottom: 0.75rem; } +.local-login-panel { + margin-top: 1.25rem; + border-top: 1px solid var(--border); + padding-top: 1rem; +} + +.local-login-panel summary { + cursor: pointer; + color: var(--muted); + font-size: 0.875rem; + user-select: none; + list-style: none; + display: flex; + align-items: center; + gap: 0.4rem; +} + +.local-login-panel summary::-webkit-details-marker { display: none; } + +.local-login-panel summary::before { + content: '›'; + font-size: 1.1em; + transition: transform 0.15s; + display: inline-block; +} + +.local-login-panel[open] summary::before { + transform: rotate(90deg); +} + +.local-login-panel summary:hover { + color: var(--text); +} + +.local-login-panel form { + margin-top: 1rem; +} + /* ─── Light theme ────────────────────────────────────────────────────────── */ @media (prefers-color-scheme: light) { :root { diff --git a/app/templates/login.html b/app/templates/login.html index d740062..ee71fce 100644 --- a/app/templates/login.html +++ b/app/templates/login.html @@ -2,31 +2,51 @@ {% block title %}Sign in · {{ app_name }}{% endblock %} {% block body %}
-
+

{{ app_name }}

Sign in to continue

- {% if error %}
{{ error }}
{% endif %} - - - - - {% if ldap_enabled %} -
-

Sign in with LDAP

-

Use your directory username and password

- - - -
- {% endif %} + {% if ldap_enabled %} + +
+ {% if ldap_error %}
{{ ldap_error }}
{% endif %} + + + +
+ + + + {% else %} + +
+ {% if local_error %}
{{ local_error }}
{% endif %} + + + +
+ + {% endif %} +
{% endblock %} diff --git a/app/web/pages.py b/app/web/pages.py index 8658453..2d8ea2b 100644 --- a/app/web/pages.py +++ b/app/web/pages.py @@ -50,12 +50,11 @@ async def login_submit( ): user = await user_crud.authenticate(db, email, password) if user is None: - # Re-render the form with an error (HTMX swaps the form partial). return templates.TemplateResponse( request, "login.html", { - "error": "Incorrect email or password", + "local_error": "Incorrect email or password", "email": email, "ldap_enabled": settings.ldap_enabled, }, @@ -82,7 +81,7 @@ async def login_ldap_submit( request, "login.html", { - "error": "LDAP sign-in failed", + "ldap_error": "Incorrect username or password", "username": username, "ldap_enabled": True, },