mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
fix a test in python3
This commit is contained in:
@@ -9,7 +9,7 @@ from django.core.urlresolvers import reverse
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.utils.encoding import (
|
||||
python_2_unicode_compatible, smart_bytes, smart_text)
|
||||
python_2_unicode_compatible, smart_bytes, smart_text, force_str)
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
||||
|
||||
@@ -154,7 +154,7 @@ class User(PermissionsMixin):
|
||||
match = self.password_expr.match(self.password)
|
||||
if match is None:
|
||||
return False
|
||||
raw_value = smart_bytes(raw_value)
|
||||
raw_value = force_str(raw_value)
|
||||
scheme = match.group(1)
|
||||
val2 = match.group(2)
|
||||
hasher = get_password_hasher(scheme)
|
||||
@@ -425,6 +425,7 @@ class User(PermissionsMixin):
|
||||
row += result[1]
|
||||
csvwriter.writerow(row)
|
||||
|
||||
|
||||
reversion.register(User)
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ from random import Random
|
||||
import string
|
||||
|
||||
from django.utils.crypto import constant_time_compare
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
|
||||
class PasswordHasher(object):
|
||||
@@ -35,7 +36,7 @@ class PasswordHasher(object):
|
||||
"""
|
||||
if self._target == 'ldap':
|
||||
return base64.b64encode(pwhash)
|
||||
return pwhash
|
||||
return force_text(pwhash)
|
||||
|
||||
def encrypt(self, clearvalue):
|
||||
"""Encrypt a password.
|
||||
|
||||
Reference in New Issue
Block a user