protected function createComponentLoginForm($name)
 {
     $form = new MyAppForm($this, $name);
     if ($this->useAjax) {
         $form->enableAjax();
     }
     if (!$this->useAutocomplete) {
         $form->getElementPrototype()->autocomplete('off');
     }
     if (isset($this->getPresenter()->translator)) {
         $form->setTranslator($this->getPresenter()->translator);
     }
     if ($this->errorsAsFlashMessages) {
         $form->setErrorsAsFlashMessages();
     }
     $form->addClass('loginFrm');
     $form->addText('username', $this->labels['username'])->addRule(Form::FILLED, 'Enter your username!');
     $form->addPassword('password', $this->labels['password'])->addRule(Form::FILLED, 'Enter your password!');
     if ($this->useRemember) {
         $form->addCheckbox('remember', $this->labels['remember']);
     }
     //	if using labelOver we need to add class to ensure label is visible with javascript disabled
     if ($this->useLabelOver) {
         $form['password']->getLabelPrototype()->class('onlyJS');
         $form['username']->getLabelPrototype()->class('onlyJS');
     }
     $form->addHidden('key');
     $form->addHidden('anchor');
     $form->addSubmit('ok', $this->labels['submit'])->getControlPrototype()->class[] = 'ok-button';
     if ($this->useProtection) {
         $form->addProtection('Form validity time expired. Please send the form again.');
     }
     $form->onSubmit[] = callback($this, 'loginFormSubmitted');
     return $form;
 }
 /**
  * form for setting only credentials - mandatory
  *
  * @return MyAppForm
  */
 protected function createComponentCredentialsForm()
 {
     $form = new MyAppForm();
     $form->getElementPrototype()->class('ajax');
     if (!is_null($this->getTranslator())) {
         $form->setTranslator($this->getTranslator());
     }
     $form->addText('username', 'Prihlasovacie meno')->addRule(Form::FILLED)->addRule(Form::MIN_LENGTH, NULL, 3)->addRule(Form::MAX_LENGTH, NULL, 30);
     $form->addPassword("password", "Nové heslo", 60)->addRule(Form::FILLED)->addRule(Form::MIN_LENGTH, NULL, 6);
     $form->addPassword("password2", "Potvrďte nové heslo", 60)->addRule(Form::FILLED, "%label !")->addRule(Form::EQUAL, 'Heslá sa nezhodujú!', $form['password']);
     if (!$this->changeForgottenPass) {
         $form->addPassword("currentPassword", "Stávajúce heslo", 60)->addRule(Form::FILLED);
     }
     // to allow relogin after change of credentials - used when user forgot password and was redirected from ForgottenPass::tempLogin()
     $form->addHidden('loginOnSuccess');
     $form->addSubmit('save', 'Save')->getControlPrototype()->class[] = 'ok-button';
     $form->onSubmit[] = callback($this, 'save');
     /*
     		$_this = $this;
     		$form->onSubmit[] = function(MyAppForm $form) use($_this) {
     			try {
     				if ($form['save']->isSubmittedBy()) {
     					$values = $form->getValues();
     					unset($values['password2']);
     					
     					$_this->model->updateLoggedUser($values, true);
     					$_this->flashMessage('Password updated.', $_this::FLASH_MESSAGE_SUCCESS);
     		
     				}
     			} catch (DibiDriverException $e) {
     				Debug::log($e);
     				$_this->flashMessage("ERROR: cannot save data!", $_this::FLASH_MESSAGE_ERROR);
     			} catch (InvalidPasswordException $e) {
     				$_this->flashMessage($e->getMessage(), $_this::FLASH_MESSAGE_ERROR);
     			}
     	
     			$_this->refresh(null, 'this');
     		};*/
     return $form;
 }