/**
  * Registrační formulář
  * @return Form
  */
 protected function createComponentRegistrationForm()
 {
     $form = new Nette\Application\UI\Form();
     $presenter = $this;
     $form->setMethod('POST');
     $form->addText('name', 'Name:')->setAttribute('placeholder', 'Name')->setAttribute('class', 'text')->addRule(Nette\Forms\Form::FILLED, 'You have to input your name!')->addRule(Nette\Forms\Form::MIN_LENGTH, 'You have to input your name!', 2);
     $form->addText('email', 'E-mail:')->setAttribute('placeholder', 'E-mail')->setAttribute('class', 'text')->addRule(Nette\Forms\Form::EMAIL, 'You have to input valid e-mail address!')->addRule(Nette\Forms\Form::FILLED, 'You have to input your e-mail!')->addRule(function ($emailInput) use($presenter) {
         try {
             $presenter->usersFacade->findUserByEmail($emailInput->value);
             return false;
         } catch (\Exception $e) {
         }
         return true;
     }, 'User account with this e-mail already exists!');
     $password = $form->addPassword('password', 'Password:'******'placeholder', 'Password')->setAttribute('class', 'text')->addRule(Nette\Forms\Form::FILLED, 'You have to input your password!')->addRule(Nette\Forms\Form::MIN_LENGTH, 'Minimal length of password is %s characters!', 6);
     $form->addPassword('rePassword', 'Password (again):')->setAttribute('placeholder', 'Password')->setAttribute('class', 'text')->addRule(Nette\Forms\Form::FILLED, 'You have to input your password!')->addRule(Nette\Forms\Form::EQUAL, 'Passwords do not match!', $password);
     $submitButton = $form->addSubmit('submit', 'Sign up...');
     $submitButton->setAttribute('class', 'button');
     $submitButton->onClick[] = function (SubmitButton $submitButton) {
         $values = $submitButton->getForm(true)->getValues(true);
         try {
             $this->usersFacade->registerUser($values);
         } catch (Exception $e) {
             $this->flashMessage('Welcome! Your user account was successfully registered.');
         }
         $this->getUser()->login($values['email'], $values['password']);
         $this->finalRedirect();
     };
     return $form;
 }