def migrate_password(self): """If the original password was encrypted, we don't want to re-encrypt during the migration.""" # migration will have already happened correctly if the # password wasn't encrypted old_pw = self.old.getPassword() if is_encrypted(old_pw): field = self.new.getField('password') new_pw = "zauth:%s" % old_pw field.set(self.new, new_pw) # don't use mutator!
def test__doAddUser_with_not_yet_encrypted_passwords(self): # See collector #1869 && #1926 from AccessControl.AuthEncoding import is_encrypted USER_ID = 'not_yet_encrypted' PASSWORD = '******' self.assertFalse(is_encrypted(PASSWORD)) self.uf._doAddUser(USER_ID, PASSWORD, [], []) uid_and_info = self.uf.users.authenticateCredentials( {'login': USER_ID, 'password': PASSWORD}) self.assertEqual(uid_and_info, (USER_ID, USER_ID))
def test__doAddUser_with_not_yet_encrypted_passwords(self): # See collector #1869 && #1926 from AccessControl.AuthEncoding import is_encrypted USER_ID = 'not_yet_encrypted' PASSWORD = '******' self.failIf(is_encrypted(PASSWORD)) self.uf._doAddUser(USER_ID, PASSWORD, [], []) uid_and_info = self.uf.users.authenticateCredentials( {'login': USER_ID, 'password': PASSWORD }) self.assertEqual(uid_and_info, (USER_ID, USER_ID))
def test_updateUserPassword_with_not_yet_encrypted_password(self): from AccessControl.AuthEncoding import is_encrypted USER_ID = 'not_yet_encrypted' PASSWORD = '******' self.failIf(is_encrypted(PASSWORD)) zum = self._makeOne() zum.addUser(USER_ID, USER_ID, '') zum.updateUserPassword(USER_ID, PASSWORD) uid_and_info = zum.authenticateCredentials( {'login': USER_ID, 'password': PASSWORD }) self.assertEqual(uid_and_info, (USER_ID, USER_ID))
def test_updateUserPassword_with_not_yet_encrypted_password(self): from AccessControl.AuthEncoding import is_encrypted USER_ID = 'not_yet_encrypted' PASSWORD = '******' self.failIf(is_encrypted(PASSWORD)) zum = self._makeOne() zum.addUser(USER_ID, USER_ID, '') zum.updateUserPassword(USER_ID, PASSWORD) uid_and_info = zum.authenticateCredentials({ 'login': USER_ID, 'password': PASSWORD }) self.assertEqual(uid_and_info, (USER_ID, USER_ID))