Esempio n. 1
0
 public function testGetValidateHash()
 {
     $password = uniqid();
     $hash = $this->_model->getHash($password);
     $this->assertTrue(is_string($hash));
     $this->assertTrue($this->_model->validateHash($password, $hash));
 }
Esempio n. 2
0
 public function testGetHashRandomSaltSpecifiedLength()
 {
     $this->_randomGenerator->expects($this->once())->method('getRandomString')->with(11)->will($this->returnValue('random_salt'));
     $expected = '4c5cab8dd00137d11258f8f87b93fd17bd94c5026fc52d3c5af911dd177a2611:random_salt:1';
     $actual = $this->_model->getHash('password', 11);
     $this->assertEquals($expected, $actual);
 }
Esempio n. 3
0
 public function testGetHashRandomSaltSpecifiedLength()
 {
     $this->_randomGenerator->expects($this->once())->method('getRandomString')->with(11)->will($this->returnValue('random_salt'));
     $expected = 'e6730b5a977c225a86cd76025a86a6fc:random_salt';
     $actual = $this->_model->getHash('password', 11);
     $this->assertEquals($expected, $actual);
 }
 /**
  * @inheritdoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->collection->addAttributeToSelect('*');
     $customerCollection = $this->collection->getItems();
     /** @var $customer Customer */
     foreach ($customerCollection as $customer) {
         $customer->load($customer->getId());
         if (!$this->encryptor->validateHashVersion($customer->getPasswordHash())) {
             list($hash, $salt, $version) = explode(Encryptor::DELIMITER, $customer->getPasswordHash(), 3);
             $version .= Encryptor::DELIMITER . Encryptor::HASH_VERSION_LATEST;
             $customer->setPasswordHash($this->encryptor->getHash($hash, $salt, $version));
             $customer->save();
             $output->write(".");
         }
     }
     $output->writeln(".");
     $output->writeln("<info>Finished</info>");
 }