src/PHPDish/Bundle/UserBundle/Controller/ResettingController.php
public function sendEmailAction(Request $request)
    {
        $form = $this->createForm(ResettingRequestType::class);
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $this->getEventDispatcher()->addListener(FOSUserEvents::RESETTING_SEND_EMAIL_INITIALIZE,
                [$this, 'onSendEmailInitialize']
            );
            return parent::sendEmailAction($request);
        }
        //处理失败调回请求页面
        foreach ($form->getErrors(true) as $error) {
            $this->addFlash('danger', $error->getMessage());
        }
        $this->get('session')->set(static::LAST_USERNAME_SESSION_KEY, $form->getData()['username'] ?? '');
        return $this->redirectToRoute('fos_user_resetting_request');
    }
public function sendEmailAction(Request $request)
    {
        $form = $this->createForm(ResettingRequestType::class);
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $this->getEventDispatcher()->addListener(FOSUserEvents::RESETTING_SEND_EMAIL_INITIALIZE,
                [$this, 'onSendEmailInitialize']
            );
            return parent::sendEmailAction($request);
        }
        //处理失败调回请求页面
        foreach ($form->getErrors(true) as $error) {
            $this->addFlash('danger', $error->getMessage());
        }
        $this->get('session')->set(static::LAST_USERNAME_SESSION_KEY, $form->getData()['username'] ?? '');
        return $this->redirectToRoute('fos_user_resetting_request');
    }
重置密码
{@inheritdoc}