{% extends 'account/base.html' %}

{% load i18n %}
{% load account socialaccount %}

{% block head_title %}{% trans 'Sign In' %}{% endblock %}

{% block content %}
<h3 class="mb-2">{% trans 'Sign In' %}</h3>

{% get_providers as socialaccount_providers %}
{% if socialaccount_providers %}
<p>
  {% blocktrans trimmed %}
  Please sign in with one of your existing third party accounts.
  Or, sign in using your email address below. If you don't have an account, please <a href="{{ signup_url }}" class="link-accent">sign up</a> for one.
  {% endblocktrans %}
</p>
<div class="socialaccount_ballot border border-gray-200 card bg-gray-100 my-3">
  <div class="card-body p-6">
    <ul class="socialaccount_providers grid grid-cols-2 gap-2">
      {% include "socialaccount/snippets/provider_list.html" with process="login" %}
    </ul>
    {% include "socialaccount/snippets/login_extra.html" %}
  </div>
</div>

<div class="divider">
  {% trans 'OR' %}
</div>

{% else %}
<p class="border-b border-gray-300 mb-3 pb-5">
  {% blocktrans trimmed %}
  If you have not created an account yet, then please <a href="{{ signup_url }}" class="link-accent">sign up</a> first.
  {% endblocktrans %}
</p>
{% endif %}

<form class="login" method="POST" action="{% url 'account_login' %}">
  {% csrf_token %}
  {{ form.as_p }}
  {% if redirect_field_value %}
  <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
  {% endif %}
  <div class="flex items-center justify-between pb-0 pt-5">
    <a class="secondaryAction link-accent" href="{% url 'account_reset_password' %}">
      {% trans 'Forgot Password?' %}
    </a>
    <button class="inline-flex items-center btn btn-primary primaryAction">
      {% trans 'Sign In' %}
      <i class="ri-arrow-right-circle-line ml-3 text-xl"></i>
    </button>
  </div>
</form>
{% endblock %}
