Elcodi\Store\UserBundle\Controller\PasswordController::recoverAction PHP Méthode

recoverAction() public méthode

Recover password
public recoverAction ( Form $passwordRecoverForm, boolean $isValid, string $hash ) : Response
$passwordRecoverForm Symfony\Component\Form\Form Password recover form
$isValid boolean Is valid
$hash string Hash
Résultat Symfony\Component\HttpFoundation\Response Response
    public function recoverAction(Form $passwordRecoverForm, $isValid, $hash)
    {
        if ($isValid) {
            $customer = $this->get('elcodi.repository.customer')->findOneBy(['recoveryHash' => $hash]);
            if ($customer instanceof AbstractUser) {
                $password = $passwordRecoverForm->get('password')->getData();
                $this->get('elcodi.manager.password')->recoverPassword($customer, $hash, $password);
                return $this->redirectToRoute('store_homepage');
            }
        }
        return $this->renderTemplate('Pages:user-password-change.html.twig', ['form' => $passwordRecoverForm->createView()]);
    }