Commit 0920371a authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

base/credential: fix password type ( use str )

parent 3d24a52a
...@@ -263,7 +263,7 @@ class TestAuthenticationPolicy(ERP5TypeTestCase): ...@@ -263,7 +263,7 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
[x.getPassword() for x in self._getPasswordEventList(login)]) [x.getPassword() for x in self._getPasswordEventList(login)])
# other methods (edit)... # other methods (edit)...
login.edit(password = '123456789-4') login.edit(password='123456789-4')
self.tic() self.tic()
old_password5 = login.getPassword() old_password5 = login.getPassword()
self.assertSameSet([old_password5, old_password4, old_password3, old_password2, old_password1, old_password], \ self.assertSameSet([old_password5, old_password4, old_password3, old_password2, old_password1, old_password], \
......
...@@ -36,10 +36,12 @@ from Acquisition import aq_base ...@@ -36,10 +36,12 @@ from Acquisition import aq_base
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from erp5.component.interface.IEncryptedPassword import IEncryptedPassword from erp5.component.interface.IEncryptedPassword import IEncryptedPassword
from Products.ERP5Type.Globals import PersistentMapping from Products.ERP5Type.Globals import PersistentMapping
from Products.ERP5Type.Utils import bytes2str
from Products.CMFCore.utils import _checkPermission from Products.CMFCore.utils import _checkPermission
from Products.CMFCore.exceptions import AccessControl_Unauthorized from Products.CMFCore.exceptions import AccessControl_Unauthorized
from six import string_types as basestring from six import string_types as basestring
@zope.interface.implementer(IEncryptedPassword,) @zope.interface.implementer(IEncryptedPassword,)
class EncryptedPasswordMixin(object): class EncryptedPasswordMixin(object):
"""Encrypted Password Mixin """Encrypted Password Mixin
...@@ -103,7 +105,7 @@ class EncryptedPasswordMixin(object): ...@@ -103,7 +105,7 @@ class EncryptedPasswordMixin(object):
# workflows on this method. # workflows on this method.
self.password = PersistentMapping() self.password = PersistentMapping()
if value: if value:
self._setEncodedPassword(pw_encrypt(value)) self._setEncodedPassword(bytes2str(pw_encrypt(value)))
def _setPassword(self, value): def _setPassword(self, value):
self.checkPasswordValueAcceptable(value) self.checkPasswordValueAcceptable(value)
......
# type: () -> bytes # type: () -> str
if context.getId() == 'test_ERP5_Logo_Encrypted_PDF': if context.getId() == 'test_ERP5_Logo_Encrypted_PDF':
return 'secret' return 'secret'
return context.skinSuper('erp5_dms_ui_test', 'PDF_getContentPassword')(REQUEST=REQUEST) return context.skinSuper('erp5_dms_ui_test', 'PDF_getContentPassword')(REQUEST=REQUEST)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment