Added authorization page

This commit is contained in:
Кулаков Юрий 2021-02-07 20:17:27 +03:00
parent 2919761b2f
commit f6193a837a
4 changed files with 42 additions and 1 deletions

View File

@ -126,3 +126,6 @@ STATICFILES_DIRS = [
]
MEDIA_ROOT = BASE_DIR / 'media'
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/'

View File

@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls')),
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -0,0 +1,37 @@
{% extends 'base/base.html' %}
{% block title %}
Авторизация
{% endblock %}
{% block content %}
<div class="container">
<div class="card mx-auto" style="width: 40rem">
<div class="card-body pb-0">
<form method="post">
{% csrf_token %}
{% for field in form %}
<label class="form-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
<input
required=""
class="form-control mb-3"
id="{{ field.id_for_label }}"
name="{{ field.html_name }}"
type="{{ field.widget_type }}"
/>
{% endfor %}
{% if form.non_field_errors %}
<ul class='form-errors'>
{% for error in form.non_field_errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
<div class="text-center">
<button type="submit" class="btn btn-primary">Войти</button>
<a href="" class="btn btn-link" style="display: block;">Забыли пароль?</a>
</div>
</form>
</div>
</div>
</div>
{% endblock %}