Example #1
2
 /**
  * new user form
  * @return \Nette\Application\UI\Form
  */
 public function createComponentNewUser()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText('username', _("Login name:"), 30)->setRequired(_("You must enter login name !!"));
     $form->addText('name', _("Whole name:"), 30)->setRequired(_("You must enter whole name !!"));
     $form->addPassword("password", _("New Password"), 30)->addRule(\Nette\Application\UI\Form::MIN_LENGTH, _("Password must have minimal 6 letters"), 6);
     $form->addPassword("repeatedPassword", _("New password repeated"), 30)->addRule(\Nette\Application\UI\Form::EQUAL, _("Repeated password is not same as new password."), $form->getComponent('password'));
     $form->addText('refer_phys_key', _("Reference physician key:"), 30);
     $form->addText('email', _("Email address:"), 30)->addRule(\Nette\Application\UI\Form::EMAIL, _("Valid email address must be filled"));
     $form->addRadioList("role", _("Role"), array("administrator" => _("Administrator"), "moderator" => _("Moderator"), "viewer" => _("Viewer"), "externist" => _("Externist")))->setRequired();
     $form->addSubmit('save', _("Add user"));
     $form->onSuccess[] = array($this, 'processNewUser');
     $this->setFromBootstrap($form);
     return $form;
 }
 /**
  * Form for changing password
  *
  * @Action("default")
  * @Privilege("default")
  */
 protected function createComponentChangePasswordForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->addPassword('oldpassword', 'Současné heslo:')->setRequired('Zadejte současné heslo');
     $form->addPassword('password', 'Nové heslo:')->setRequired('Zvolte si heslo')->addRule(\Nette\Application\UI\Form::MIN_LENGTH, 'Heslo musí mít alespoň %d znaků', 6);
     $form->addPassword('passwordVerify', 'Heslo pro kontrolu:')->setRequired('Zadejte prosím heslo ještě jednou pro kontrolu')->addRule(\Nette\Application\UI\Form::EQUAL, 'Hesla se neshodují', $form['password']);
     $form->addSubmit('send', 'Změnit');
     $form->onSuccess[] = $this->changePasswordSucceded;
     return $form;
 }
Example #3
0
 /**
  * factory to change password form
  * @return \Nette\Application\UI\Form
  */
 public function createComponentChangePassword()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addPassword("oldPassword", _("Old password"), 30)->setRequired(_("You must enter old password"));
     $form->addPassword("newPassword", _("New Password"), 30)->addRule(\Nette\Application\UI\Form::MIN_LENGTH, _("Password must have minimal 6 letters"), 6);
     $form->addPassword("repeatedPassword", _("New password repeated"), 30)->addRule(\Nette\Application\UI\Form::EQUAL, _("Repeated password is not same as new password."), $form->getComponent('newPassword'));
     $form->addSubmit('save', _("Change password"));
     $form->onSuccess[] = array($this, 'processChangePassword');
     $this->setFromBootstrap($form);
     return $form;
 }
Example #4
0
 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentRegisterForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText("username", $this->t("forms.register.labels.username"))->setRequired($this->t("forms.register.rules.req-username"))->addRule($form::MAX_LENGTH, $this->t("forms.register.rules.max-username", array("length" => 64)), 64);
     $form->addPassword("password", $this->t("forms.register.labels.password"))->setRequired($this->t("forms.register.rules.req-password"));
     $form->addPassword("passwordControl", $this->t("forms.register.labels.password-control"))->setRequired($this->t("forms.register.rules.req-password-control"))->addRule($form::EQUAL, $this->t("forms.register.rules.eq-password"), $form["password"]);
     $form["password"]->addRule($form::EQUAL, $this->t("forms.register.rules.eq-password"), $form["passwordControl"]);
     $form->addText("email", $this->t("forms.register.labels.email"))->setRequired($this->t("forms.register.rules.req-email"))->addRule($form::EMAIL, $this->t("forms.register.rules.email-email"))->addRule($form::MAX_LENGTH, $this->t("forms.register.rules.max-email", array("length" => 128)), 128);
     $form->addSubmit("send", $this->t("forms.register.labels.register"));
     $form->onSuccess[] = $this->processRegister;
     return $form;
 }
 public function createComponentLoginForm()
 {
     $form = new \Nette\Application\UI\Form($this, 'loginForm');
     $form->addText('login', 'Uživatelské jméno:')->addRule(\Nette\Application\UI\Form::FILLED, 'Musíte vyplnit uživatelské jméno!');
     $form->addPassword('password', 'Heslo:')->addRule(\Nette\Application\UI\Form::FILLED, 'Musíte vyplnit heslo!');
     $form->addSubmit('doLogin', 'Přihlásit se');
     $form->onSuccess[] = array($this, 'loginFormSubmitted');
     return $form;
 }
Example #6
0
 /**
  * factory to login form
  * @return \Nette\Application\UI\Form
  */
 public function createComponentLoginForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText('username', _("Username:"******"Enter valid username !!"));
     $form->addPassword('password', _("Password:"******"Enter valid password !!"));
     $form->addSubmit('login', _("Sign in"));
     $form->onSuccess[] = array($this, 'processLoginForm');
     $this->setFromBootstrap($form);
     return $form;
 }
Example #7
0
 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentSignForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText("username", $this->t("forms.sign.labels.username"))->setRequired($this->t("forms.sign.rules.req-username"));
     $form->addPassword("password", $this->t("forms.sign.labels.password"))->setRequired($this->t("forms.sign.rules.req-password"));
     $form->addCheckbox("remember", $this->t("forms.sign.labels.remember"));
     $form->addSubmit("send", $this->t("forms.sign.labels.login"));
     $form->onSuccess[] = $this->processForm;
     $this->setDefaults($form);
     return $form;
 }
Example #8
0
 /**
  * Sign-in form factory.
  * @author Petr Besir Horacek <*****@*****.**>
  * @return Nette\Application\UI\Form
  */
 protected function createComponentSignInForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText('username', 'Username:'******'Please enter your username.');
     $form->addPassword('password', 'Password:'******'Please enter your password.');
     $form->addCheckbox('remember', 'Keep me signed in');
     $form->addSubmit('send', 'Sign in');
     // call method signInFormSucceeded() on success
     $form->onSuccess[] = $this->signInFormSucceeded;
     return $form;
 }
Example #9
0
 /**
  * Sign-in form factory.
  * @return \Nette\Application\UI\Form
  */
 public function createComponentSignUpForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addGroup('');
     //$em = $this->em;
     $form->addText('username', 'Username')->setRequired('Username is required');
     /*
     			->addCondition(Form::FILLED)
     				->addRule(function($control) use($em) {
     					$value = $control->value;
     					return $em->getRepository('User')->findOneByUsername($value) === NULL;
     				}, 'This username is already taken');
     * 
     */
     $password1 = $form->addPassword('password', 'Password')->setRequired('Fill in the password');
     $password2 = $form->addPassword('password2', 'Password (verify)')->addConditionOn($password1, Form::FILLED)->addRule(Form::FILLED, 'Fill in the password again');
     $password2->addCondition(Form::FILLED)->addRule(Form::EQUAL, 'Passwords do not match', $password1);
     $form->addText('captcha', 'Who you gonna call!? (v108b)')->setRequired('Answer to the security question is required')->addRule(Form::EQUAL, 'Bad answer', 'v108b');
     $form->addSubmit('submit', 'Register me!');
     $form->onSuccess[] = $this->signUpSuccess;
     return $form;
 }
Example #10
0
 public function createComponentLoginForm()
 {
     $form = new Nette\Application\UI\Form();
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'div class="control-group"';
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = 'div class="controls"';
     $form->setTranslator($this->parent->translator);
     $form->getElementPrototype()->setClass("ajax");
     // ajax
     $form->addText('username', 'Username')->setRequired()->getLabelPrototype()->setClass('control-label');
     $form['username']->getControlPrototype()->setClass(' input-block-level');
     $form->addPassword('password', 'Password')->setRequired()->getLabelPrototype()->setClass('control-label');
     $form['password']->getControlPrototype()->setClass(' input-block-level');
     $form->addSubmit('login', 'Log in')->setAttribute("class", "btn");
     $form->onSuccess[] = callback($this, "login");
     return $form;
 }
 /**
  * Sign-in form factory.
  *
  * @return Nette\Application\UI\Form
  */
 protected function createComponentSignInForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText('username', 'Jméno:')->setRequired('Vložte přihlašovací jméno.');
     $form->addPassword('password', 'Heslo:')->setRequired('Vložte své heslo.');
     $form->addCheckbox('remember', 'Zůstat přihlášen');
     $form->addSubmit('send', 'Přihlásit');
     // form presentation
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = 'div';
     $form->onSuccess[] = $this->signInFormSucceeded;
     return $form;
 }
Example #12
0
 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentSetNewPassword()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addHidden("key", "");
     $form->addHidden("id", 0);
     $form->addPassword("password", $this->t("forms.forgot-password.labels.password"))->setRequired($this->t("forms.forgot-password.rules.req-password"));
     $form->addPassword("passwordControl", $this->t("forms.forgot-password.labels.password-control"))->setRequired($this->t("forms.forgot-password.rules.req-password-control"))->addRule($form::EQUAL, $this->t("forms.forgot-password.rules.eq-password"), $form["password"]);
     $form["password"]->addRule($form::EQUAL, $this->t("forms.forgot-password.rules.eq-password"), $form["passwordControl"]);
     $form->addSubmit("send", $this->t("forms.forgot-password.labels.change"));
     $form->onSuccess[] = $this->setNewPassword;
     if (!is_null($this->actionKey)) {
         $form->setDefaults(array("key" => $this->actionKey->getKey(), "id" => $this->actionKey->getUserId()));
     }
     return $form;
 }