{% extends "ra/admin/base_site.html" %}

{% load i18n static %}

{% block extrastyle %}{{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% static "admin/css/login.css" %}">
    {{ form.media }}
{% endblock %}

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

{% block usertools %}{% endblock %}

{% block nav-global %}{% endblock %}
{% block nav_bar_header %} {% endblock %}
{% block main_sidebar %} {% endblock %}
{% block content_title %}{% endblock %}

{% block breadcrumbs %}{% endblock %}


{% block wrapper %}

    <div class="login-box">
        <div class="login-logo">
            <a href=""><b>Ra</b>framework</a>
        </div>

        {% if form.errors and not form.non_field_errors %}
            <p class="errornote">
                {% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
            </p>
        {% endif %}

        {% if form.non_field_errors %}
            {% for error in form.non_field_errors %}
                <p class="errornote">
                    {{ error }}
                </p>
            {% endfor %}
        {% endif %}

        <div id="" class="card">
            <div class="card-body login-card-body">
                <p class="login-box-msg">Sign in to start your session</p>
                {% if user.is_authenticated %}
                    <p class="errornote">
                        {% blocktrans trimmed %}
                            You are authenticated as {{ username }}, but are not authorized to
                            access this page. Would you like to login to a different account?
                        {% endblocktrans %}
                    </p>
                {% endif %}

                <form action="{{ app_path }}" method="post">
                    {% csrf_token %}
                    <div class="input-group mb-3">
                        {{ form.username.errors }}
                        <input class="form-control" placeholder="{% trans 'Username' %}" name="username">
                        <div class="input-group-append">
                            <div class="input-group-text">
                                <span class="fas fa-user"></span>
                            </div>
                        </div>
                    </div>
                    <div class="input-group mb-3">
                        {{ form.password.errors }}
                        <input type="password" class="form-control" placeholder="Password" name="password">
                        <div class="input-group-append">
                            <div class="input-group-text">
                                <span class="fas fa-lock"></span>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-8">
                            {#                        <div class="icheck-primary">#}
                            {#                            <input type="checkbox" id="remember">#}
                            {#                            <label for="remember">#}
                            {#                                Remember Me#}
                            {#                            </label>#}
                            {#                        </div>#}
                        </div>
                        <!-- /.col -->
                        <div class="col-4">
                            <button type="submit" class="btn btn-primary btn-block">Sign In</button>
                        </div>
                        <!-- /.col -->
                        {% url 'admin_password_reset' as password_reset_url %}
                        {% if password_reset_url %}
                            <div class="password-reset-link ">
                                <a href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a>
                            </div>
                        {% endif %}
                    </div>
                </form>

                <form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
                    {#                <div class="form-row input-group mb-3">#}
                    {#                    {{ form.username.errors }}#}
                    {#                    {{ form.username.label_tag }} {{ form.username }}#}
                    {#                </div>#}
                    {#                <div class="form-row input-group mb-3">#}
                    {#                    {{ form.password.errors }}#}
                    {#                    {{ form.password.label_tag }} {{ form.password }}#}
                    {#                    <input type="hidden" name="next" value="{{ next }}">#}
                    {#                </div>#}
                    {% url 'admin_password_reset' as password_reset_url %}
                    {% if password_reset_url %}
                        <div class="password-reset-link">
                            <a href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a>
                        </div>
                    {% endif %}
                </form>
            </div>
        </div>
    </div>
{% endblock %}

{% block footer %} {% endblock %}