{% extends 'mainapp/base.html' %}

{% block title %}Вход в систему{% endblock %}

{% block content %}
<div class="container mt-5">
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card">
                <div class="card-body">
                    <h2 class="card-title text-center">Вход в систему</h2>
                    <form method="post">
                        {% csrf_token %}
                        <div class="mb-3">
                            <label for="{{ form.username.id_for_label }}" class="form-label">Имя пользователя</label>
                            <input type="text" name="username" class="form-control" id="{{ form.username.id_for_label }}" required>
                        </div>
                        <div class="mb-3">
                            <label for="{{ form.password.id_for_label }}" class="form-label">Пароль</label>
                            <input type="password" name="password" class="form-control" id="{{ form.password.id_for_label }}" required>
                        </div>
                        {% if form.errors %}
                            <div class="alert alert-danger">
                                {% for field in form %}
                                    {% for error in field.errors %}
                                        <p>{{ error }}</p>
                                    {% endfor %}
                                {% endfor %}
                                {% for error in form.non_field_errors %}
                                    <p>{{ error }}</p>
                                {% endfor %}
                            </div>
                        {% endif %}
                        <div class="d-grid">
                            <button type="submit" class="btn btn-primary">Войти</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}