From 132dd1e7b88aba0518a4811a377fd77f91945d3c Mon Sep 17 00:00:00 2001 From: lian Date: Mon, 28 Mar 2016 15:36:18 +0800 Subject: [PATCH] update True/False check when use constance.config --- seahub/auth/forms.py | 4 ++-- seahub/base/accounts.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/seahub/auth/forms.py b/seahub/auth/forms.py index 6df7fe4467..a6f81785f7 100644 --- a/seahub/auth/forms.py +++ b/seahub/auth/forms.py @@ -143,8 +143,8 @@ class SetPasswordForm(forms.Form): if 'new_password1' in self.cleaned_data: pwd = self.cleaned_data['new_password1'] - if config.USER_STRONG_PASSWORD_REQUIRED is True: - if is_user_password_strong(pwd) is True: + if bool(config.USER_STRONG_PASSWORD_REQUIRED) is True: + if bool(is_user_password_strong(pwd)) is True: return pwd else: raise forms.ValidationError( diff --git a/seahub/base/accounts.py b/seahub/base/accounts.py index ed53bab1d6..456ebc9856 100644 --- a/seahub/base/accounts.py +++ b/seahub/base/accounts.py @@ -382,7 +382,7 @@ class RegistrationBackend(object): site = RequestSite(request) from registration.models import RegistrationProfile - if config.ACTIVATE_AFTER_REGISTRATION is True: + if bool(config.ACTIVATE_AFTER_REGISTRATION) is True: # since user will be activated after registration, # so we will not use email sending, just create acitvated user new_user = RegistrationProfile.objects.create_active_user(username, email, @@ -523,8 +523,8 @@ class RegistrationForm(forms.Form): if 'password1' in self.cleaned_data: pwd = self.cleaned_data['password1'] - if config.USER_STRONG_PASSWORD_REQUIRED is True: - if is_user_password_strong(pwd) is True: + if bool(config.USER_STRONG_PASSWORD_REQUIRED) is True: + if bool(is_user_password_strong(pwd)) is True: return pwd else: raise forms.ValidationError(