From f4084c800abf25c440a8663801b842d788409b0b Mon Sep 17 00:00:00 2001 From: xiaodong Date: Fri, 8 Jun 2018 16:15:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[Bugfix]=20=E6=9B=B4=E6=96=B0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E6=97=B6=E4=B8=8D=E5=A1=AB=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E4=B9=9F=E4=BC=9A=E8=A7=A6=E5=8F=91=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E5=88=99=E9=AA=8C=E8=AF=81,=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/users/views/user.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/users/views/user.py b/apps/users/views/user.py index 598726fc1..3adb1d156 100644 --- a/apps/users/views/user.py +++ b/apps/users/views/user.py @@ -109,12 +109,13 @@ class UserUpdateView(AdminUserRequiredMixin, SuccessMessageMixin, UpdateView): def form_valid(self, form): password = form.cleaned_data.get('password') - is_ok = check_password_rules(password) - if not is_ok: - form.add_error( - "password", _("* Your password does not meet the requirements") - ) - return self.form_invalid(form) + if password: + is_ok = check_password_rules(password) + if not is_ok: + form.add_error( + "password", _("* Your password does not meet the requirements") + ) + return self.form_invalid(form) return super().form_valid(form) From 221fae5875261d1c13df6fa72abd7adab42b1974 Mon Sep 17 00:00:00 2001 From: BaiJiangJie Date: Fri, 8 Jun 2018 16:34:15 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[Bugfix]=20=E4=BF=AE=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=A4=B1=E6=95=88=E6=97=A5=E6=9C=9F=E6=88=AA=E6=AD=A2?= =?UTF-8?q?=E5=90=8E=E8=BF=98=E5=8F=AF=E7=99=BB=E5=BD=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/users/forms.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/users/forms.py b/apps/users/forms.py index 06c544383..165694c3f 100644 --- a/apps/users/forms.py +++ b/apps/users/forms.py @@ -16,13 +16,14 @@ class UserLoginForm(AuthenticationForm): max_length=128, strip=False ) + def confirm_login_allowed(self, user): + if not user.is_staff: + raise forms.ValidationError( + self.error_messages['inactive'], + code='inactive',) -class UserLoginCaptchaForm(AuthenticationForm): - username = forms.CharField(label=_('Username'), max_length=100) - password = forms.CharField( - label=_('Password'), widget=forms.PasswordInput, - max_length=128, strip=False - ) + +class UserLoginCaptchaForm(UserLoginForm): captcha = CaptchaField() From 1ef582e9ace0f13ce801bc04c76d34061760a84d Mon Sep 17 00:00:00 2001 From: xiaodong Date: Fri, 8 Jun 2018 16:39:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[Update]=E5=88=A0=E9=99=A4=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E9=85=8D=E7=BD=AE=E4=B8=AD=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84BROKER=5FURL=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config_example.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/config_example.py b/config_example.py index 45d4b00f3..0c8d87094 100644 --- a/config_example.py +++ b/config_example.py @@ -51,11 +51,6 @@ class Config: REDIS_HOST = '127.0.0.1' REDIS_PORT = 6379 REDIS_PASSWORD = '' - BROKER_URL = 'redis://%(password)s%(host)s:%(port)s/3' % { - 'password': REDIS_PASSWORD, - 'host': REDIS_HOST, - 'port': REDIS_PORT, - } def __init__(self): pass