public function forgotPassword(Request $request)
    {
        $form = $this->app->form(new PhraseaForgotPasswordForm());
        $service = $this->getRecoveryService();

        try {
            if ('POST' === $request->getMethod()) {
                $form->handleRequest($request);

                if ($form->isValid()) {
                    $data = $form->getData();

                    try {
                        $service->requestPasswordResetToken($data['email'], true);
                    }
                    catch (InvalidArgumentException $ex) {
                        /** @Ignore */
                        $message = $this->app->trans($ex->getMessage());
                        throw new FormProcessingException($message, 0, $ex);
                    }

                    $this->app->addFlash('info', $this->app->trans('phraseanet:: Un email vient de vous etre envoye'));

                    return $this->app->redirectPath('login_forgot_password');
                }
            }
        } catch (FormProcessingException $e) {
            $this->app->addFlash('error', $e->getMessage());
        }

        return $this->render('login/forgot-password.html.twig', array_merge(
            $this->getDefaultTemplateVariables($request),
            [ 'form'  => $form->createView() ]
        ));
    }
public function forgotPassword(Request $request)
    {
        $form = $this->app->form(new PhraseaForgotPasswordForm());
        $service = $this->getRecoveryService();

        try {
            if ('POST' === $request->getMethod()) {
                $form->handleRequest($request);

                if ($form->isValid()) {
                    $data = $form->getData();

                    try {
                        $service->requestPasswordResetToken($data['email'], true);
                    }
                    catch (InvalidArgumentException $ex) {
                        /** @Ignore */
                        $message = $this->app->trans($ex->getMessage());
                        throw new FormProcessingException($message, 0, $ex);
                    }

                    $this->app->addFlash('info', $this->app->trans('phraseanet:: Un email vient de vous etre envoye'));

                    return $this->app->redirectPath('login_forgot_password');
                }
            }
        } catch (FormProcessingException $e) {
            $this->app->addFlash('error', $e->getMessage());
        }

        return $this->render('login/forgot-password.html.twig', array_merge(
            $this->getDefaultTemplateVariables($request),
            [ 'form'  => $form->createView() ]
        ));
    }
public function forgotPassword ( Request $ request ) { $ form = $ this -> app -> form ( new PhraseaForgotPasswordForm ( ) ) ; $ service = $ this -> getRecoveryService ( ) ; try { if ( 'POST' === $ request -> getMethod ( ) ) { $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ data = $ form -> getData ( ) ; try { $ service -> requestPasswordResetToken ( $ data [ 'email' ] , true ) ; } catch ( InvalidArgumentException $ ex ) { /** @Ignore */ $ message = $ this -> app -> trans ( $ ex -> getMessage ( ) ) ; throw new FormProcessingException ( $ message , 0 , $ ex ) ; } $ this -> app -> addFlash ( 'info' , $ this -> app -> trans ( 'phraseanet:: Un email vient de vous etre envoye' ) ) ; return $ this -> app -> redirectPath ( 'login_forgot_password' ) ; } } } catch ( FormProcessingException $ e ) { $ this -> app -> addFlash ( 'error' , $ e -> getMessage ( ) ) ; } return $ this -> render ( 'login/forgot-password.html.twig' , array_merge ( $ this -> getDefaultTemplateVariables ( $ request ) , [ 'form' => $ form -> createView ( ) ] ) ) ; }
Submit the new password

@param  Request $request The current request
@return RedirectResponse
Submit the new password