login.twig 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. {% extends 'layout.twig' %}
  2. {% block title %}Sign in — IRDB{% endblock %}
  3. {% block guest_content %}
  4. <div class="flex min-h-screen items-center justify-center bg-slate-50 px-4 dark:bg-slate-950">
  5. <div class="w-full max-w-md rounded-2xl border border-slate-200 bg-white p-8 shadow-sm dark:border-slate-800 dark:bg-slate-900">
  6. <div class="mb-6 text-center">
  7. <h1 class="font-mono text-2xl font-bold tracking-tight">IRDB</h1>
  8. <p class="mt-1 text-sm text-slate-500 dark:text-slate-400">Sign in to continue</p>
  9. </div>
  10. {% if oidc_enabled %}
  11. <a href="/login/oidc"
  12. class="flex w-full items-center justify-center rounded-md bg-indigo-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:focus:ring-offset-slate-900">
  13. Sign in with Microsoft
  14. </a>
  15. {% endif %}
  16. {% if local_admin_enabled %}
  17. <div class="mt-6" x-data="{ open: {{ oidc_enabled ? 'false' : 'true' }} }">
  18. {% if oidc_enabled %}
  19. <div class="relative my-4 text-center">
  20. <span class="bg-white px-2 text-xs uppercase tracking-wider text-slate-400 dark:bg-slate-900">or</span>
  21. <div class="absolute inset-x-0 top-1/2 -z-10 h-px bg-slate-200 dark:bg-slate-800"></div>
  22. </div>
  23. <button type="button"
  24. x-on:click="open = !open"
  25. class="text-sm text-slate-500 underline hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200">
  26. <span x-text="open ? 'Hide local sign-in' : 'Use local sign-in'"></span>
  27. </button>
  28. {% endif %}
  29. <form x-show="open"
  30. x-cloak
  31. method="post"
  32. action="/login/local"
  33. class="mt-4 space-y-3">
  34. {% include 'partials/csrf.twig' %}
  35. <div>
  36. <label for="username" class="block text-sm font-medium text-slate-700 dark:text-slate-300">Username</label>
  37. <input type="text" name="username" id="username" required autocomplete="username"
  38. class="mt-1 block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-sm shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:border-slate-700 dark:bg-slate-950">
  39. </div>
  40. <div>
  41. <label for="password" class="block text-sm font-medium text-slate-700 dark:text-slate-300">Password</label>
  42. <input type="password" name="password" id="password" required autocomplete="current-password"
  43. class="mt-1 block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-sm shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:border-slate-700 dark:bg-slate-950">
  44. </div>
  45. <button type="submit"
  46. class="flex w-full items-center justify-center rounded-md bg-slate-800 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-slate-700 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2 dark:bg-slate-700 dark:hover:bg-slate-600">
  47. Sign in
  48. </button>
  49. </form>
  50. </div>
  51. {% endif %}
  52. {% if not oidc_enabled and not local_admin_enabled %}
  53. <p class="text-sm text-red-600 dark:text-red-400">No sign-in method is enabled. Set <code>OIDC_ENABLED=true</code> or <code>LOCAL_ADMIN_ENABLED=true</code> in the configuration.</p>
  54. {% endif %}
  55. </div>
  56. </div>
  57. {% endblock %}