{% extends "account/base_entrance.html" %}{% load i18n allauth account %}

<!---->
{% block head_title %}{% trans "Sign In" %}{% endblock %}

<!---->
{% block content %}
<div class="container-prose">
  <h1>{% trans "Sign In" %}</h1>

  {% if not SOCIALACCOUNT_ONLY %}
  <p>
    {% blocktrans trimmed %}If you have not created an account yet, then please
    <a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}
  </p>

  <form action="{% url 'account_login' %}" method="post" class="grid gap-4">
    {% csrf_token %}{{ redirect_field }}

    <!---->
    {% include 'allauth/components/form.html' %}

    <button type="submit" class="btn btn-sm btn-primary lg:btn-md 2xl:btn-lg">
      <i data-lucide="log-in" class="size-4 lg:size-6"></i>
      {% trans "Sign In" %}
    </button>
  </form>
  {% endif %}

  <!---->
  {% if LOGIN_BY_CODE_ENABLED or PASSKEY_LOGIN_ENABLED %}
  <div role="separator" class="divider divider-neutral font-bold">
    {% trans 'OR' %}
  </div>

  <div class="grid gap-4">
    {% if PASSKEY_LOGIN_ENABLED %}
    <button
      type="submit"
      id="passkey_login"
      form="mfa_login"
      class="btn btn-sm btn-secondary lg:btn-md 2xl:btn-lg"
    >
      <i data-lucide="key" class="size-4 lg:size-6"></i>
      {% trans "Sign in with a passkey" %}
    </button>
    {% endif %}

    <!---->
    {% if LOGIN_BY_CODE_ENABLED %}
    <a
      href="{{ request_login_code_url }}"
      class="btn btn-sm btn-accent lg:btn-md 2xl:btn-lg"
    >
      <i data-lucide="square-asterisk" class="size-4 lg:size-6"></i>
      {% trans "Send me a sign-in code" %}
    </a>
    {% endif %}
  </div>
  {% endif %}

  <!---->
  {% if SOCIALACCOUNT_ENABLED %}
  <!---->
  {% include 'socialaccount/snippets/login.html' with page_layout='entrance' %}
  <!---->
  {% endif %}
</div>
{% endblock %}

<!---->
{% block extra_body %}{{ block.super }}
<!---->
{% if PASSKEY_LOGIN_ENABLED %}
<!---->
{% include 'mfa/webauthn/snippets/login_script.html' with button_id='passkey_login' %}
<!---->
{% endif %}
<!---->
{% endblock %}
