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

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

{% block content %}

{% if form.errors %}
{% show_message "error" _("This username/password combination was not found. Please try again.") %}
{% endif %}

{% if demo_server %}
{% show_message "info" _("To test Weblate, you can login as <code>demo</code> user with password <code>demo</code>.") %}
{% endif %}

<div class="row">

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

<form method="post" action="{% url 'login' %}">
<div class="panel panel-primary">
  <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 %}
{% blocktrans %}Forgot your password? You can <a href="{{ reset_url }}">reset it</a>.{% endblocktrans %}
{% endif %}
</p>

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

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

</div>

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

{% if login_backends %}

<div class="panel panel-primary">
  <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-primary">
  <div class="panel-heading"><h4 class="panel-title">{% trans "Registration" %}</h4></div>
  <div class="panel-body">

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

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

</div>
</div>

{% endblock %}
