Example #1
0
 /**
  * @param \Nette\Application\UI\Form $form
  */
 public function processForm(\Nette\Application\UI\Form $form)
 {
     $values = $form->getValues();
     $ok = true;
     $user = $this->userRepository->findUserByEmail($values->email);
     if (!is_null($user)) {
         try {
             $actionKey = $this->actionKeyRepository->createKey(\Model\Core\ActionKey\ActionKeyTypeCode::PASSWORD, $user->getId());
             $this->sendEmail($actionKey, $user);
         } catch (\Exception $e) {
             $ok = false;
             $this->catchFormError($e, $form, $this->t("global.errors.action-error"));
         }
         if ($ok) {
             $this->presenter->flashMessage($this->t("forms.forgot-password.messages.sended"), "info");
             $this->presenter->redirect("Homepage:default");
         }
     } else {
         $this->flashMessage($this->t("forms.forgot-password.errors.wrong-email"), "warning");
     }
 }