{% 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 %}

{% if demo_server %}
<div class="alert alert-info">
<p>
{% trans "To test Weblate on this demo server, you can log in as the following users:" %}
</p>
<table class="table table-condensed">
<thead>
<tr>
<th>{% trans "Username" %}</th>
<th>{% trans "Password" %}</th>
<th>{% trans "Description" %}</th>
</tr>
</thead>
<tbody>
{% for name, password, description in demo_users %}
<tr>
<td><code>{{ name }}</code></td>
<td><code>{{ password }}</code></td>
<td>{{ description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% 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 %}
{% 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-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 %}
{% trans "Do not have an account yet?" %}
<a href="{{ register_url }}">{% trans "You can register." %}</a>
</p>

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

</div>
</div>

{% endblock %}
