{% extends "base.html" %}

{% block title %} | Sign in{% endblock %}
{% block bodydata %} class="login" {% endblock %}

{% block main %}
<div class="container">
	<div class="row">
		<div class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
			<h3 class="header">Sign in</h3>
			{% include 'snippets/messages.html' %}

			{% if form.errors %}
				<div class="alert alert-danger">
					<p>We were unable to authenticate you. Either email or password are incorrect. Please try again.</p>
				</div>
			{% elif request.GET.next %}
				<div class="alert alert-warning">
					<p>Please sign in to continue.</p>
				</div>
			{% endif %}

			<form role="form" action="{% url 'account_login' %}{% if request.GET.next %}?next={{ request.GET.next }}{% endif %}" method="POST" novalidate>
				{% csrf_token %}
				<input type="hidden" name="next" value="{{ request.REQUEST.next }}" />

				<div class="form-group {% if form.login.errors %}has-error{% endif %}">
					<label for="login">Email address</label>
					<input type="email" class="form-control input-lg" id="login" name="login" value="{{ form.data.login }}" required />
				</div>

				<div class="form-group {% if form.password.errors %}has-error{% endif %}">
					<label for="inputPassword">Password</label>
					<input type="password" class="form-control input-lg" id="password" name="password" value="{{ form.data.password }}" required />
				</div>

				<div class="form-group">
					<button type="submit" class="btn btn-primary">Sign in</button>
				</div>
			</form>

			<div class="well text-center">Not a member yet? Please <a href="{% url 'account_signup' %}">sign up here</a> &bull; <a href="{% url 'account_reset_password' %}">Forgot password?</a></div>
		</div>
	</div>
</div>
{% endblock %}

{% block libraries %}
<script src="/static/js/admin.ui.forms.validate.js"></script>
{% endblock %}
