login.twig 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. <img src="/assets/logo.svg" alt="IRDB" class="mx-auto h-24 w-24" />
  8. <h1 class="mt-4 font-mono text-2xl font-bold tracking-tight">IRDB</h1>
  9. <p class="mt-1 text-sm text-slate-500 dark:text-slate-400">IP Reputation Database</p>
  10. <p class="mt-3 text-sm text-slate-500 dark:text-slate-400">Sign in to continue</p>
  11. </div>
  12. {% if oidc_enabled %}
  13. <a href="/login/oidc"
  14. 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">
  15. Sign in with Microsoft
  16. </a>
  17. {% endif %}
  18. {% if local_admin_enabled %}
  19. <div class="mt-6" x-data="loginForm" data-initial-open="{{ oidc_enabled ? '0' : '1' }}">
  20. {% if oidc_enabled %}
  21. <div class="relative my-4 text-center">
  22. <span class="bg-white px-2 text-xs uppercase tracking-wider text-slate-400 dark:bg-slate-900">or</span>
  23. <div class="absolute inset-x-0 top-1/2 -z-10 h-px bg-slate-200 dark:bg-slate-800"></div>
  24. </div>
  25. <button type="button"
  26. x-on:click="flip()"
  27. class="text-sm text-slate-500 underline hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200">
  28. <span x-text="toggleLabel"></span>
  29. </button>
  30. {% endif %}
  31. <form x-show="open"
  32. x-cloak
  33. method="post"
  34. action="/login/local"
  35. class="mt-4 space-y-3">
  36. {% include 'partials/csrf.twig' %}
  37. <div>
  38. <label for="username" class="block text-sm font-medium text-slate-700 dark:text-slate-300">Username</label>
  39. <input type="text" name="username" id="username" x-ref="usernameInput" required autocomplete="username"
  40. {% if not oidc_enabled %}autofocus{% endif %}
  41. 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">
  42. </div>
  43. <div>
  44. <label for="password" class="block text-sm font-medium text-slate-700 dark:text-slate-300">Password</label>
  45. <input type="password" name="password" id="password" required autocomplete="current-password"
  46. 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">
  47. </div>
  48. <button type="submit"
  49. 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">
  50. Sign in
  51. </button>
  52. </form>
  53. </div>
  54. {% endif %}
  55. {% if not oidc_enabled and not local_admin_enabled %}
  56. <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>
  57. {% endif %}
  58. </div>
  59. </div>
  60. {% endblock %}