Commit 47bd93a2 authored by Jérome Perrin's avatar Jérome Perrin Committed by Kazuhiko Shiozaki

base/credential: fix password type ( use str )

parent 58e75319
......@@ -263,7 +263,7 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
[x.getPassword() for x in self._getPasswordEventList(login)])
# other methods (edit)...
login.edit(password = '123456789-4')
login.edit(password='123456789-4')
self.tic()
old_password5 = login.getPassword()
self.assertSameSet([old_password5, old_password4, old_password3, old_password2, old_password1, old_password], \
......
......@@ -36,10 +36,12 @@ from Acquisition import aq_base
from Products.ERP5Type import Permissions
from erp5.component.interface.IEncryptedPassword import IEncryptedPassword
from Products.ERP5Type.Globals import PersistentMapping
from Products.ERP5Type.Utils import bytes2str
from Products.CMFCore.utils import _checkPermission
from Products.CMFCore.exceptions import AccessControl_Unauthorized
from six import string_types as basestring
@zope.interface.implementer(IEncryptedPassword,)
class EncryptedPasswordMixin(object):
"""Encrypted Password Mixin
......@@ -103,7 +105,7 @@ class EncryptedPasswordMixin(object):
# workflows on this method.
self.password = PersistentMapping()
if value:
self._setEncodedPassword(pw_encrypt(value))
self._setEncodedPassword(bytes2str(pw_encrypt(value)))
def _setPassword(self, value):
self.checkPasswordValueAcceptable(value)
......
# type: () -> bytes
# type: () -> str
if context.getId() == 'test_ERP5_Logo_Encrypted_PDF':
return 'secret'
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