python 3 fixes
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
Forms for the password policy app.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import six
|
||||
|
||||
from django.contrib import messages
|
||||
from django.contrib.admin.forms import AdminAuthenticationForm
|
||||
from django.forms import ValidationError
|
||||
@@ -25,9 +28,9 @@ class PasswordPolicyAwareAdminAuthForm(AdminAuthenticationForm):
|
||||
password_policy_compliance.enforce_compliance_on_login(self.user_cache, cleaned_data['password'])
|
||||
except password_policy_compliance.NonCompliantPasswordWarning as e:
|
||||
# Allow login, but warn the user that they will be required to reset their password soon.
|
||||
messages.warning(self.request, e.message)
|
||||
messages.warning(self.request, six.text_type(e))
|
||||
except password_policy_compliance.NonCompliantPasswordException as e:
|
||||
# Prevent the login attempt.
|
||||
raise ValidationError(e.message)
|
||||
raise ValidationError(six.text_type(e))
|
||||
|
||||
return cleaned_data
|
||||
|
||||
Reference in New Issue
Block a user