{% extends 'base.html' %}
{% load i18n %}

{% block title %}{% trans 'Login to yourivatar account' %}{% endblock title %}

{% block content %}

<h1>{% trans 'Login' %}</h1>

{% if form.errors %}
    {% for error in form.non_field_errors %}
<div class="alert alert-danger" role="alert">{{ error|escape }}</div>
    {% endfor %}
{% endif %}
{% if form.username.errors %}
<div class="alert alert-danger" role="alert">{{ form.username.errors }}</div>
{% endif %}
{% if form.password.errors %}
<div class="alert alert-danger" role="alert">{{ form.password.errors }}</div>
{% endif %}
<div class="form-container">
<form action="{% url 'login' %}" method="post" name="login">
{% csrf_token %}
{% if next %}<input type="hidden" name="next" value="{{ next }}">{% endif %}
<div class="form-group">
<label for="id_username" class="form-label">{% trans 'Username' %}</label>
<input type="text" name="username" autofocus required class="form-control" id="id_username" placeholder="{% trans 'Enter your username' %}">
</div>
<div class="form-group">
<label for="id_password" class="form-label">{% trans 'Password' %}</label>
<input type="password" name="password" class="form-control" required id="id_password" placeholder="{% trans 'Enter your password' %}">
</div>

<div class="button-group">
  <button type="submit" class="btn btn-primary">{% trans 'Login' %}</button>
  <a href="{% url 'openid-login' %}" class="btn btn-secondary">{% trans 'Login with OpenID' %}</a>
  {% if with_fedora %}
  <a href="{% url "social:begin" "fedora" %}" class="btn btn-secondary">{% trans 'Login with Fedora' %}</a>
  {% endif %}
  <a href="{% url 'new_account' %}" class="btn btn-secondary">{% trans 'Create new user' %}</a>
  <a href="{% url 'password_reset' %}" class="btn btn-secondary">{% trans 'Password reset' %}</a>
</div>
</form>
</div>
<div style="height:40px"></div>
{% endblock content %}
