Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public function testSubmitElement()
 {
     /** @var Fieldset $buttons */
     $buttons = $this->testedObject->get('buttons');
     $buttonInput = $buttons->get('button');
     $this->assertInstanceOf('Zend\\Form\\Element\\Submit', $buttonInput);
 }
Ejemplo n.º 3
0
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  *
  * @return ForgotPassword
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /**
      * @var $filter ForgotPasswordInputFilter
      */
     $filter = $serviceLocator->get('Auth\\Form\\ForgotPasswordInputFilter');
     $form = new ForgotPassword();
     $form->setInputfilter($filter);
     return $form;
 }