public function indexAction() { /** @var \Zend\Http\Request $request */ $request = $this->getRequest(); try { if ($request->isPost()) { $this->form->setData($request->getPost()->toArray() ?: array()); if ($this->form->isValid()) { $mailer = $this->getPluginManager()->get('Mailer'); $url = $this->plugin('url'); $this->service->proceed($this->form->getInputFilter(), $mailer, $url); $this->notification()->success('Mail with link for reset password has been sent, please try to check your email box'); } else { $this->notification()->danger('Please fill form correctly'); } } } catch (Exception\UserNotFoundException $e) { $this->notification()->danger('User cannot be found for specified username or email'); } catch (Exception\UserDoesNotHaveAnEmailException $e) { $this->notification()->danger('Found user does not have an email'); } catch (\Exception $e) { $this->logger->crit($e); $this->notification()->danger('An unexpected error has occurred, please contact your system administrator'); } return array('form' => $this->form); }