{% extends "cranefly/layout.html" %}
{% import "_forms.html" as form_theme with context %}
{% import "cranefly/macros.html" as macros with context %}

{% block title %}{{ macros.page_title(title=_('Sign In')) }}{% endblock %}
     
{% block content %}
<div class="row">
  <div class="span6 offset3">
    <div class="form-container">

      <div class="form-header">
        <h1>{% trans %}Sign In to Your Account{% endtrans %}</h1>
      </div>

      {% if message %}
      <div class="messages-list">
        <div class="alert alert-{{ message.type }}">
          {{ macros.draw_message_icon(message) }}
          <p><strong>{{ message.message }}</strong></p>
          {% if bad_password %}
          <p><a href="{% url 'forgot_password' %}">{% trans %}Click here if you forgot your sign in credentials.{% endtrans %}</a></p>
          {% endif %}
          {% if not_active %}
          <p><a href="{% url 'send_activation' %}">{% trans %}Click here if you didn't receive activation e-mail.{% endtrans %}</a></p>
          {% endif %}
          {% if banned_account.reason_user %}
          {{ banned_account.reason_user|markdown|safe }}
          {% endif %}
          {% if banned_account.expires %}
          <p><strong>{% trans ban_expires=banned_account.expires|date %}Your ban will expire on {{ ban_expires }}{% endtrans %}</p>
          {% endif %}
        </div>
      </div>
      {% endif %}

      <form class="form-horizontal" action="{% url 'sign_in' %}" method="post">
        <div class="form-fields">
          {{ form_theme.form_widget(form, horizontal=true, width=6) }}
        </div>
        <div class="form-actions">
          <button type="submit" class="btn btn-primary">{% trans %}Sign In{% endtrans %}</button>
          <div class="signin-help">

            <h2>{% trans %}Problems Signing In?{% endtrans %}</h2>
            <ul class="unstyled">
              <li><a href="{% url 'forgot_password' %}"><i class="icon-refresh"></i> {% trans %}I don't remember my password{% endtrans %}</a></li>
              <li><a href="{% url 'send_activation' %}"><i class="icon-envelope"></i> {% trans %}I haven't received activation e-mail{% endtrans %}</a></li>
              {% if settings.account_activation != 'block' %}
              <li><a href="{% url 'register' %}"><i class="icon-edit"></i> {% trans %}I don't have account{% endtrans %}</a></li>
              {% endif %}
            </ul>

          </div>
        </div>
      </form>

    </div>
  </div>
</div>
{% endblock %}