PasswordEncoder 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
            )
$query = $builder->getQuery();

        $total = $this->get('models')->getQueryCount($query);
        $data = $query->getArrayResult();

        $this->View()->assign(['success' => true, 'data' => $data, 'total' => $total]);
    }

    public function getAvailableHashesAction()
    {
        /** @var PasswordEncoderInterface[] $hashes */
        $hashes = Shopware()->PasswordEncoder()->getCompatibleEncoders();

        $result = [];

        $result[] = ['id' => 'Auto'];

        $blacklist = ['prehashed', 'legacybackendmd5'];

        foreach ($hashes as $hash) {
            if (\in_array(strtolower($hash->getName())$blacklist)) {
                continue;
            }

            

        if ($this->firstLogin === null) {
            $this->firstLogin = new DateTime();
        }
        if ($this->lastLogin === null) {
            $this->lastLogin = new DateTime();
        }

        if (!empty($this->rawPassword)) {
            $this->hashPassword = $this->rawPassword;
        } elseif (!empty($this->password)) {
            $this->encoderName = Shopware()->PasswordEncoder()->getDefaultPasswordEncoderName();
            $this->hashPassword = Shopware()->PasswordEncoder()->encodePassword($this->password, $this->encoderName);
        }
    }

    /** * Event listener method which is fired when the model is updated. * * @ORM\PreUpdate() * * @throws LogicException (See AttributeCleanerTrait) */
    
Shopware_Components_Translation $translationComponent = null,
        ?Connection $connection = null,
        ?OptInLoginServiceInterface $optInLoginService = null,
        ?CSRFTokenValidator $csrfTokenValidator = null,
        ?ShippingCostServiceInterface $shippingCostService = null
    ) {
        $this->db = $db ?: Shopware()->Db();
        $this->eventManager = $eventManager ?: Shopware()->Events();
        $this->config = $config ?: Shopware()->Config();
        $this->session = $session ?: Shopware()->Session();
        $this->front = $front ?: Shopware()->Front();
        $this->passwordEncoder = $passwordEncoder ?: Shopware()->PasswordEncoder();
        $this->snippetManager = $snippetManager ?: Shopware()->Snippets();
        $this->moduleManager = $moduleManager ?: Shopware()->Modules();
        $this->sSYSTEM = $systemModule ?: Shopware()->System();

        $mainShop = Shopware()->Shop()->getMain() !== null ? Shopware()->Shop()->getMain() : Shopware()->Shop();
        $this->scopedRegistration = $mainShop->getCustomerScope();

        $this->contextService = $contextService ?: Shopware()->Container()->get(ContextServiceInterface::class);
        $this->emailValidator = $emailValidator ?: Shopware()->Container()->get(EmailValidator::class);
        $this->subshopId = $this->contextService->getShopContext()->getShop()->getParentId();
        $this->attributeLoader = Shopware()->Container()->get(DataLoader::class);
        
Home | Imprint | This part of the site doesn't use cookies.