{% extends "base.html" %}
{% load i18n %}
{% load bootstrap3 %}

{% block title %}{% trans "Login" %}{% endblock %}

{% block content %}
<div class="container">
  <div class="row">
    <div class="col-sm-offset-1 col-sm-10">
      <h1>{% trans "Login" %}</h1>
      <p>{% trans "Not yet registered?" %}
        <a href="{% url 'registration_register' %}">{% trans "Register here" %}</a></p>
      <p>{% trans "Trouble signing in?" %}
        <a href="{% url 'django.contrib.auth.views.password_reset' %}">{% trans "Reset password" %}</a></p>
    </div>
  </div>
  {% if form.errors %}
  <div class="row">
    <div class="alert alert-danger col-sm-offset-2 col-sm-6">
      <p><strong>{% trans "Login failed. Try again..." %}</strong></p>
    </div>
  </div>
  {% endif %}
  <div class="col-md-6">
    <form action="{% url 'django.contrib.auth.views.login' %}"
        method="post"
        role="form"
        class="form-horizontal">
      {% csrf_token %}
      {% bootstrap_field form.username layout='horizontal' %}
      {% bootstrap_field form.password layout='horizontal' %}
      {% if next %}
        <input type="hidden" name="next" value="{{ next }}" />
      {% else %}
      <!-- Need to add Login Redirect Url -->
        <input type="hidden" name="next" value= "{% url 'station_list' %}" />
      {% endif %}
      {% buttons %}
      <div class="col-sm-offset-3 col-sm-10">
        <button type="submit" class="btn btn-primary">{% trans "Login" %}</button>
      </div>
      {% endbuttons %}
    </form>
  </div>
{% endblock %}
