{% extends "base.html" %}
{% load i18n %}
{% load translations %}
{% load authnames %}
{% load crispy_forms_tags %}

{% block breadcrumbs %}
<li><a href="{% url 'login' %}">{% trans "Log in" %}</a></li>
{% endblock %}

{% block content %}

{% if form.errors %}
{% trans "This username/password combination was not found. Please try again." as msg %}
{% show_message "error" msg %}
{% endif %}

<div class="row">

<div class="col-lg-6">

<form method="post" action="{% url 'login' %}">
<div class="panel panel-default">
  <div class="panel-heading"><h4 class="panel-title">{% trans "Password login" %}</h4></div>
  <div class="panel-body">

{% csrf_token %}
{{ form|crispy }}
<p class="helptext">
{% if can_reset %}
{% url 'password_reset' as reset_url %}
{% trans "Forgot your password?" %}
<a href="{{ reset_url }}">{% trans "You can reset it." %}</a>
{% endif %}
</p>

<input type="hidden" name="next" value="{{ next }}" />

</div>
<div class="panel-footer">
<input type="submit" value="{% trans "Login" %}" class="btn btn-primary" />
</div>
</div>
</form>

</div>

<div class="col-lg-6">

{% if login_backends %}

<div class="panel panel-default">
  <div class="panel-heading"><h4 class="panel-title">{% trans "Third party login" %}</h4></div>
  <div class="panel-body">

{% for name in login_backends %}
  <a class="btn btn-link link-post" href="{% url 'social:begin' name %}{% if next %}?next={{ next }}{% endif %}">{% auth_name name %}</a>
{% endfor %}
</div>
</div>

{% endif %}

{% if registration_open %}
<div class="panel panel-default">
  <div class="panel-heading"><h4 class="panel-title">{% trans "Registration" %}</h4></div>
  <div class="panel-body">

<p>
{% url 'register' as register_url %}
{% trans "Do not have an account yet?" %}
<a href="{{ register_url }}">{% trans "You can register." %}</a>
</p>

</div>
</div>
{% endif %}

</div>
</div>

{% endblock %}
