/**
  * Formulář pro obnovu zapomenutého hesla
  * @return Form
  */
 protected function createComponentForgottenPasswordForm()
 {
     $form = new Form();
     $form->setTranslator($this->translator);
     $form->addProtection('Please submit the form again');
     $form->addText('email', 'E-mail:')->setRequired('You have to input your e-mail!')->addRule(Form::EMAIL, 'You have to input valid e-mail!');
     $form->addSubmit('submit', 'Submit...')->onClick[] = function (SubmitButton $button) {
         $values = $button->getForm(true)->getValues(true);
         try {
             $user = $this->usersFacade->findUserByEmail($values['email']);
             $userForgottenPassword = $this->usersFacade->generateUserForgottenPassword($user);
             /** @var MailerControl $mailerControl */
             $mailerControl = $this->getComponent('mailerControl', true);
             $result = $mailerControl->sendMailForgottenPassword($userForgottenPassword);
             if ($result) {
                 $this->flashMessage('Information to reset your password has been sent to your e-mail.');
             } else {
                 $this->flashMessage('It was not possible to sent you information for password reset. Please try it later, or contact the administrator.');
             }
         } catch (\Exception $e) {
             //nebyl nalezen příslušný přihlašovací účet...
             $this->flashMessage('Selected user account does not exist. Please register a new one...');
             $this->redirect('register');
             return;
         }
         $this->redirect('login');
     };
     $form->addSubmit('storno', 'storno')->setValidationScope([])->onClick[] = function () {
         $this->redirect('login');
     };
     return $form;
 }