From 82b151a3a7125daa094e974fc190087516655a17 Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Tue, 20 Dec 2022 11:22:16 +0500 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D0=B2=D0=BE=D0=B6=D1=83=20=D1=81?= =?UTF-8?q?=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=20?= =?UTF-8?q?=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B5=20=D1=83=D1=81=D0=BF=D0=B5?= =?UTF-8?q?=D1=88=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BB=D0=B8=D0=B1=D0=BE=20?= =?UTF-8?q?=D0=BD=D0=B5=D1=83=D0=B4=D0=B0=D1=87=D0=BD=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D1=81=D0=BB=D0=B8=D1=87=D0=B5=D0=BD=D0=B8=D0=B9=20(=D0=B0?= =?UTF-8?q?=D1=83=D1=82=D0=B5=D0=BD=D1=82=D0=B8=D1=84=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8)=20#17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cms/views.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cms/views.py b/cms/views.py index adc2db6..d0a0837 100644 --- a/cms/views.py +++ b/cms/views.py @@ -2,6 +2,7 @@ import os from json import JSONEncoder import requests +from django.contrib import messages from django.contrib.auth import authenticate, login from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import LoginRequiredMixin @@ -109,8 +110,14 @@ class AuthenticationView(View): authenticated_user = authenticate(username=username, password=password) if authenticated_user is None: + messages.add_message(request, + messages.ERROR, + 'Неправильное имя пользователя и/или пароль') return HttpResponseRedirect(reverse('authenticate')) else: + messages.add_message(request, + messages.SUCCESS, + 'Поздравляю, вы вошли успешно') login(request, user=authenticated_user) return HttpResponseRedirect(reverse('new-article'))