diff --git a/access_controller/settings.py b/access_controller/settings.py index 24c1abf..50d3201 100644 --- a/access_controller/settings.py +++ b/access_controller/settings.py @@ -122,3 +122,6 @@ STATICFILES_DIRS = [ MEDIA_ROOT = BASE_DIR / 'media' MEDIA_URL = '/media/' +LOGIN_REDIRECT_URL = '/' +LOGOUT_REDIRECT_URL = '/' + diff --git a/access_controller/urls.py b/access_controller/urls.py index 9262d42..0063265 100644 --- a/access_controller/urls.py +++ b/access_controller/urls.py @@ -15,15 +15,24 @@ Including another URLconf """ from django.conf.urls.static import static from django.contrib import admin -from django.urls import path, include +from django.urls import path, include +from django.contrib.auth.views import LoginView +from django.urls import path, include from access_controller import settings from main.views import * urlpatterns = [ path('admin/', admin.site.urls, name='admin'), + path('', main_page), path('register/', CustomRegistrationView.as_view(), name='registration'), - path('', include('django_registration.backends.one_step.urls')), + #path('', include('django_registration.backends.one_step.urls')), path('profile/', profile_page, name='profile'), -] + path('accounts/login/', LoginView.as_view(extra_context={})), # TODO add extra context + path('accounts/', include('django.contrib.auth.urls')) + ] + + + + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/layouts/authorization/authorization.jpg b/layouts/authorization/authorization.jpg new file mode 100644 index 0000000..8860ad9 Binary files /dev/null and b/layouts/authorization/authorization.jpg differ diff --git a/main/templates/base/base.html b/main/templates/base/base.html index e6d3628..4507bc7 100644 --- a/main/templates/base/base.html +++ b/main/templates/base/base.html @@ -1,33 +1,57 @@ - + + - + + {% block title %}{% endblock %} - + + + {% block extra_css %}{% endblock %} - - -
-
-

- {% block heading %}{% endblock %} -

-
+ +{% include 'base/menu.html' %} -
- {% block content %}{% endblock %} +
+
+

+ {% block heading %} + {% endblock %} +

+ {% block content %} + {% endblock %}
+ +
+
+ Сайт сделан учениками Школы Программистов (Группа №02) +
+
+ + src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" + integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" + crossorigin="anonymous" +> + diff --git a/main/templates/base/menu.html b/main/templates/base/menu.html new file mode 100644 index 0000000..a7c0c3f --- /dev/null +++ b/main/templates/base/menu.html @@ -0,0 +1,26 @@ +
+ + + + +
diff --git a/main/templates/pages/index.html b/main/templates/pages/index.html new file mode 100644 index 0000000..4dc9966 --- /dev/null +++ b/main/templates/pages/index.html @@ -0,0 +1,17 @@ +{% extends 'base/base.html' %} + +{% block title %} +Главная +{% endblock %} + +{% block content %} +
+
+ +

Добро пожаловать!

+

Мы рады приветствовать Вас на нашем сайте. Главная его задача - выдавать права пользователям системы по запросу самого + пользователя.

+
Сайт использует API ZenDesk.
+
+
+{% endblock %} diff --git a/main/templates/registration/login.html b/main/templates/registration/login.html new file mode 100644 index 0000000..0917b0c --- /dev/null +++ b/main/templates/registration/login.html @@ -0,0 +1,40 @@ +{% extends 'base/base.html' %} +{% block title %} + Авторизация +{% endblock %} +{% block heading %} + Авторизация +{% endblock %} +{% block content %} +
+
+
+ +
+ {% csrf_token %} + {% for field in form %} + + + {% endfor %} + {% if form.non_field_errors %} +
    + {% for error in form.non_field_errors %} +
  • {{ error }}
  • + {% endfor %} +
+ {% endif %} +
+ + Забыли пароль? +
+
+
+
+
+{% endblock %} diff --git a/main/views.py b/main/views.py index 44faa65..bd260b2 100644 --- a/main/views.py +++ b/main/views.py @@ -1,6 +1,7 @@ from django.shortcuts import render from django.urls import reverse_lazy + from main.extra_func import set_and_get_name, set_and_get_email, load_and_get_image, set_and_get_role, check_user_exist, \ check_user_auth from main.models import UserProfile @@ -64,6 +65,7 @@ def profile_page(request): :return: объект ответа сервера с HTML-кодом внутри """ if request.user.is_authenticated: + #UP = UserProfile.objects.get(user=request.user) UP = UserProfile.objects.get(user=request.user) #else: # TODO: Убрать после появления регистрации и авторизации, добавить login_required() #UP = UserProfile.objects.get(user=1) @@ -75,3 +77,8 @@ def profile_page(request): 'pagename': 'Страница профиля' } return render(request, 'pages/profile.html', context) + + +def main_page(request): + return render(request, 'pages/index.html') +