isHashExpired example

try {
            $page = $this->recoverPasswordPageLoader->load($request$context$hash);
        } catch (ConstraintViolationException|CustomerNotFoundByHashException) {
            $this->addFlash(self::DANGER, $this->trans('account.passwordHashNotFound'));

            return $this->redirectToRoute('frontend.account.recover.request');
        }

        $this->hook(new AccountRecoverPasswordPageLoadedHook($page$context));

        if ($page->getHash() === null || $page->isHashExpired()) {
            $this->addFlash(self::DANGER, $this->trans('account.passwordHashNotFound'));

            return $this->redirectToRoute('frontend.account.recover.request');
        }

        return $this->renderStorefront('@Storefront/storefront/page/account/profile/reset-password.html.twig', [
            'page' => $page,
            'formViolations' => $request->get('formViolations'),
        ]);
    }

    
static::assertEquals(200, $response->getStatusCode());
        static::assertStringContainsString($recoveryCreated['hash'](string) $response->getContent());

        static::assertNotNull(AuthTestSubscriber::$renderEvent);
        $parameters = AuthTestSubscriber::$renderEvent->getParameters();

        static::assertNotNull($parameters['page']);
        /** @var AccountRecoverPasswordPage $page */
        $page = $parameters['page'];

        static::assertEquals($recoveryCreated['hash']$page->getHash());
        static::assertFalse($page->isHashExpired());
    }

    public function testAccountRecoveryPasswordExpired(): void
    {
        $controller = $this->getAuthController();

        $recoveryCreated = $this->createRecovery(true);

        $request = $this->createRequest(
            'frontend.account.recover.password.page',
            [
                
Home | Imprint | This part of the site doesn't use cookies.