{% extends 'layouts/auth_base.html' %}
{% load i18n static admin_gradient %}

{% block title %} Log in {% endblock title %}

{% block bodyclass %} login-page {% endblock bodyclass %}

{% block content %}
<!-- [ auth-signin ] start -->
<div class="auth-wrapper">
	<div class="auth-content">
		<div class="card">
			<div class="row align-items-center text-center">
				<div class="col-md-12">
					<div class="card-body">
						<img src="{% static 'assets/images/logo-dark.png' %}" alt="" class="img-fluid mb-4">
						<h4 class="mb-3 f-w-400">Signin</h4>
						<form method="post">
              {% csrf_token %}
							<div class="input-group mb-3">
                <span class="input-group-text"><i class="feather icon-user"></i></span>
                <input type="text" name="{{form.username.name}}" class="form-control" placeholder="Username">
              </div>
              <div class="input-group mb-4">
                <span class="input-group-text"><i class="feather icon-lock"></i></span>
                <input type="password"  name="{{form.password.name}}" class="form-control" placeholder="Password">
              </div>

							<button type="submit" class="btn btn-block btn-primary mt-2 mb-4">Signin</button>

						</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- [ auth-signin ] end -->

{% endblock %}


{% block javascripts %}
<script type="application/javascript">
    {% if form.username.errors %}
        notification.danger("{{ form.username.errors }}", 'top', 'right');
    {% endif %}
    {% if form.password.errors %}
        notification.danger("{{ form.password.errors }}", 'top', 'right');
    {% endif %}

    {% if user.is_authenticated %}
        var msg = "You are authenticated as {{ username }}, but are not authorized to " +
            "access this page.Would you like to login to a different account ?"
        notification.warning(msg, 'top', 'right');
    {% endif %}

    {% if form.errors and not form.non_field_errors %}
        {% if form.errors.items|length == 1 %}
            notification.warning("{% trans "Please correct the error below." %}", 'top', 'right');
        {% else %}
            notification.warning("{% trans "Please correct the errors below." %}", 'top', 'right');
        {% endif %}
    {% endif %}

    {% if form.non_field_errors %}
        {% for error in form.non_field_errors %}
            notification.warning("{{ error|clean_text }}", 'top', 'right');
        {% endfor %}
    {% endif %}
</script>
{% endblock %}