/** * Form: User fills in e-mail address to send e-mail with a password generator link * @return string */ function createComponentChangePasswordForm() { $form = new \Nette\Forms\BootstrapUIForm(); $form->setTranslator($this->presenter->translator); $form->getElementPrototype()->class = "form-horizontal"; $form->getElementPrototype()->role = 'form'; $form->getElementPrototype()->autocomplete = 'off'; $form->addPassword("password1", "dictionary.main.Password"); $form->addPassword("password2", "Znovu napište heslo"); $form->addSubmit('name', 'dictionary.main.Change'); $form->onSuccess[] = $this->changePasswordFormSucceeded; return $form; }
/** * Form: Resets passwords in database, user fill in new password */ public function createComponentResetForm() { $form = new \Nette\Forms\BootstrapUIForm(); $form->setTranslator($this->presenter->translator); $form->getElementPrototype()->autocomplete = 'off'; $form->addHidden("email"); $form->addHidden("code"); $form->addPassword("password", "Nové heslo"); $form->addPassword("password2", "Zopakujte nové heslo"); $form->addSubmit('name', 'dictionary.main.Change'); $form->setDefaults(array("email" => $this->presenter->getParameter("email"), "code" => $this->presenter->getParameter("code"))); $form->onSuccess[] = $this->resetFormSucceeded; return $form; }
public function createComponentSignUpForm() { $form = new \Nette\Forms\BootstrapUIForm(); $form->setTranslator($this->presenter->translator); $form->getElementPrototype()->class = "form-horizontal"; $form->getElementPrototype()->role = 'form'; $form->getElementPrototype()->autocomplete = 'off'; $form->addGroup("Uživatelské informace"); $form->addText("email", "E-mail")->addRule(\Nette\Forms\Form::EMAIL, 'Zadejte platný email.')->setRequired('Vložte e-mail.'); $form->addText("username", "Uživatelské jméno")->setOption('description', (string) "Povoleny jsou pouze znaky a-z, 0-9 (pouze malá písmena)")->setRequired('Zvolte si uživatelské jméno')->addRule(\Nette\Forms\Form::PATTERN, 'Uživatelské jméno může obsahovat pouze znaky a-z, 0-9 (pouze malá písmena)', '[a-z0-9-]+')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zvolte uživatelské jméno s alespoň %d znaky', 5)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zvolte uživatelské jméno s nejvýše %d znaky', 40); if ($this->presenter->template->settings['members:groups:enabled']) { $groups = $this->database->table("categories")->where("parent_id", $this->presenter->template->settings['members:group:categoryId'])->fetchPairs("id", "title"); $form->addSelect("group", "Skupina", $groups)->setAttribute("class", "form-control"); } $form->addPassword("pwd", "dictionary.main.Password")->setOption('description', (string) "6 - 40 znaků")->setRequired('Zvolte si heslo')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zvolte heslo s alespoň %d znaky', 6)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zvolte heslo s nejvýše %d znaky', 40); $form->addPassword("pwd2", "Zopakovat heslo")->setRequired('Zadejte prosím heslo ještě jednou pro kontrolu')->addRule(\Nette\Forms\Form::EQUAL, 'Hesla se neshodují', $form['pwd']); if ($this->presenter->template->settings['members:signup:contactEnabled']) { $form->addGroup("Kontaktní údaje"); $form->addText("name", "Jméno a příjmení")->setRequired('Zadejte jméno')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zadejte jméno', 3)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zadejte jméno', 200); $form->addText("street", "dictionary.main.Street")->setRequired('Zadejte ulici')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zadejte ulici', 3)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zadejte ulici', 200)->setAttribute("class", "smartform-street-and-number"); $form->addText("zip", "PSČ")->setRequired('Zadejte PSČ')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zadejte PSČ', 3)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zadejte PSČ', 20)->setAttribute("class", "smartform-city"); $form->addText("city", "Město")->setRequired('Zadejte město')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zadejte město', 1)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zadejte město', 80)->setAttribute("class", "smartform-zip"); } if ($this->presenter->template->settings['members:signup:contactEnabled']) { $form->addGroup("Firemní informace"); $form->addText("company", "dictionary.main.Company"); $form->addText("vatin", "dictionary.main.VatIn"); $form->addText("vatid", "dictionary.main.VatId"); } $form->addCheckbox("newsletter", " " . "Chci odebírat zprávy?")->setDefaultValue(TRUE); $form->addCheckbox("confirmation", " " . "Souhlasím s podmínkami")->setRequired('Pro pokračování zaškrtněte Souhlasím s podmínkami'); $form->setDefaults(array("username" => $this->presenter->getParameter("user"), "email" => $this->presenter->getParameter("email"), "newsletter" => $this->presenter->getParameter("newsletter"), "name" => $this->presenter->getParameter("name"), "street" => $this->presenter->getParameter("street"), "city" => $this->presenter->getParameter("city"), "zip" => $this->presenter->getParameter("zip"))); $form->addSubmit("submit", "Registrovat se")->setAttribute("class", "btn-lg btn-cart-in"); $form->setDefaults(array("email" => $this->getParameter("email"), "username" => $this->getParameter("username"), "newsletter" => $this->getParameter("newsletter"))); $form->onSuccess[] = $this->signUpFormSucceeded; $form->onValidate[] = $this->signUpFormValidated; return $form; }
protected function createComponentSignInForm() { $form = new \Nette\Forms\BootstrapUIForm(); $form->setTranslator($this->presenter->translator); $form->getElementPrototype()->class = "form-horizontal"; $form->getElementPrototype()->role = 'form'; $form->getElementPrototype()->autocomplete = 'off'; $form->addHidden("type"); $form->addText("username", 'dictionary.main.User')->setRequired('Vložte uživatelské jméno.'); $form->addPassword("password", 'dictionary.main.Password')->setRequired('Vložte heslo.'); $form->addSubmit("send", 'dictionary.main.login')->setAttribute("class", "btn btn-success"); $form->onSuccess[] = $this->signInFormSucceeded; return $form; }