{% extends "common/base.html" %}

{% load crispy_forms_tags %}

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

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

{% block content %}

<div class="container col-xl-10 col-xxl-8 px-4 py-5">
  <div class="row align-items-center g-lg-5 py-5">
    <div class="col-md-10 mx-auto col-lg-5">
      <form class="p-4 p-md-5 border rounded-3 bg-light" method="POST" action="{% url 'account_login' %}">
        {% csrf_token %}
        <h1 class="h3 mb-3 fw-normal">{% trans "Sign In" %}</h1>
        {% if socialaccount_providers %}
          <p>{% blocktrans with site.name as site_name %}Please sign in with one
          of your existing third party accounts. Or, <a href="{{ signup_url }}">sign up</a>
          for a {{ site_name }} account and sign in below:{% endblocktrans %}</p>

          <div class="socialaccount_ballot">

            <ul class="socialaccount_providers">
              {% include "socialaccount/snippets/provider_list.html" with process="login" %}
            </ul>

            <div class="login-or">{% trans 'or' %}</div>

          </div>

          {% include "socialaccount/snippets/login_extra.html" %}

        {% else %}
          <p>{% blocktrans %}If you have not created an account yet, then please
          <a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
        {% endif %}
        {{ form|crispy }}
        {% get_providers as socialaccount_providers %}
        {% if redirect_field_value %}
          <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
        {% endif %}
        <button class="btn btn-primary" type="submit">{% trans "Sign In" %}</button><br>
        <a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
      </form>
    </div>
  </div>
</div>

{% endblock %}
