reencodePassword example

/** * @deprecated in 5.6, will be private in 5.8 * * @param string $plaintext * @param string $hash * @param string $encoderName * * @return void */
    public function rehash($plaintext$hash$encoderName)
    {
        $newHash = Shopware()->PasswordEncoder()->reencodePassword($plaintext$hash$encoderName);

        if ($newHash === $hash) {
            return;
        }

        $this->_zendDb->update(
            $this->_tableName,
            [$this->_credentialColumn => $newHash],
            $this->_zendDb->quoteInto(
                $this->_zendDb->quoteIdentifier($this->_identityColumn, true) . ' = ?',
                $this->_identity
            )
$newHash = '';
        $liveMigration = $this->config->offsetGet('liveMigration');
        $defaultEncoderName = $this->passwordEncoder->getDefaultPasswordEncoderName();

        // Do not allow live migration when the password is pre-hashed         if ($liveMigration && !$isPreHashed && $encoderName !== $defaultEncoderName) {
            $newHash = $this->passwordEncoder->encodePassword($plaintext$defaultEncoderName);
            $encoderName = $defaultEncoderName;
        }

        if (empty($newHash)) {
            $newHash = $this->passwordEncoder->reencodePassword($plaintext$hash$encoderName);
        }

        $userId = (int) $getUser['id'];

        if (!empty($newHash) && $newHash !== $hash) {
            $hash = $newHash;
            $this->db->update(
                's_user',
                [
                    'password' => $hash,
                    'encoder' => $encoderName,
                ],
Home | Imprint | This part of the site doesn't use cookies.