/** * Formulář pro registraci uživatele * @return Form */ public function createComponentRegistrationForm() { $form = new Form(); $form->addText('name', 'Jméno a příjmení:')->setRequired('Je nutné zadat jméno.'); $form->addText('email', 'E-mail:')->setRequired('Je nutné zadat e-mail')->addRule(Form::EMAIL, 'Je nutné zadat platnou e-mailovou adresu.')->addRule(function (TextInput $input) { return !$this->usersModel->findByEmail($input->value); }, 'Uživatel s daným e-mailem již existuje.'); $password = $form->addPassword('password', 'Heslo:')->setRequired('Je nutné zadat heslo.')->addRule(Form::MIN_LENGTH, 'Heslo musí mít minumálně 4 znaky.', 4); $form->addPassword('password2', 'Potvrzení hesla:')->addRule(Form::EQUAL, 'Zadaná hesla se neshodují.', $password); $form->addSubmit('ok', 'registrovat se')->onClick[] = function (SubmitButton $button) { //funkce pro vytvoření nového uživatelského účtu a automatick přihlášení uživatele $data = $button->form->getValues(true); $user = new User(); $user->active = true; $user->name = $data['name']; $user->email = $data['email']; $user->password = User::encodePassword($data['password']); $user->role = User::DEFAULT_REGISTERED_ROLE; if ($this->usersModel->save($user)) { $this->flashMessage('Registrace byla úspěšně dokončena.'); $this->usersModel->sendRegistrationMail($user); } $this->user->login($data['email'], $data['password']); $this->redirect('Homepage:default'); }; return $form; }
/** * Register form factory. * @return UI\Form */ protected function createComponentSignUpForm() { $form = new UI\Form(); $form->setTranslator($this->translator->domain('ui')); // 1. Antispam $form->addText(self::SPAM1)->setAttribute('style', 'display:none')->addRule(UI\Form::BLANK, 'this-field-should-be-blank'); // 2. Antispam $form->addText(self::SPAM2, self::SPAM2)->setHtmlId('frm-signUpForm-antispam')->setAttribute('data-spam', self::SPAM2)->setRequired(self::SPAM2)->addRule(UI\Form::EQUAL, self::SPAM2, self::SPAM2); $form->addText('email2', 'your-email')->setType('email')->setAttribute('placeholder', 'e-g-email-example-com')->addRule(UI\Form::EMAIL, 'please-enter-your-a-valid-email-address-check-for-typos')->setRequired('please-enter-your-a-valid-email-address-check-for-typos')->setAttribute('autofocus'); $form->addText('fullname', 'how-do-you-want-to-be-called')->setAttribute('placeholder', 'placeholder-fullname')->setRequired('please-choose-how-do-you-want-to-be-called-on-the-web'); $form->addText('username', 'login-username')->setAttribute('placeholder', 'placeholder-username')->setRequired('please-choose-your-login-username'); $form->addPassword('password', 'login-password')->setAttribute('placeholder', 'placeholder-password')->setRequired('please-choose-your-login-password')->addRule(UI\Form::MIN_LENGTH, 'please-enter-at-least-d-characters-for-your-password', 8); $form->addPassword('passwordVerify', 'confirm-password')->setAttribute('placeholder', 'placeholder-password')->setRequired('please-confirm-your-login-password')->addRule(UI\Form::EQUAL, 'please-check-your-different-password', $form['password']); $form->addSubmit('send', 'register'); $form->onSuccess[] = $this->signUpFormSucceeded; $form->getElementPrototype()->role('form'); foreach ($form->getControls() as $control) { if ($control instanceof Controls\Button) { $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default'); $usedPrimary = TRUE; } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) { $control->getControlPrototype()->addClass('form-control'); } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) { $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type); } } return $form; }
/** * @return \Nette\Application\UI\Form */ public function create() { $form = new Form(); $form->addGroup($this->user ? 'Upravit uživatele' : 'Přidat uživatele'); $form->addText("name", 'Jméno:')->setRequired('Vyplňte jméno'); $form->addText("email", 'Email:')->setRequired('Vyplňte email')->addRule(function ($ctrl) { if ($this->user and $this->user->email == $ctrl->getValue()) { return TRUE; } return (bool) (!$this->userFacade->findUserByEmail($ctrl->getValue())); }, 'Email je obsazen, zvolte prosím jiný'); $password = $form->addPassword("password", 'Heslo:'); $password2 = $form->addPassword("password2", 'Heslo znovu:'); if (!$this->user) { $password->setRequired('Vyplňte heslo'); $password2->addRule(Form::FILLED, 'Vyplňte heslo znovu pro kontrolu')->addRule(Form::EQUAL, 'Hesla se neshodují', $password); } else { $password2->addConditionOn($password, Form::FILLED)->setRequired('Vyplňte heslo znovu pro kontrolu')->addRule(Form::EQUAL, 'Hesla se neshodují', $password); } $form->addSubmit("send", $this->user ? 'Upravit uživatele' : 'Přidat uživatele'); $form->setRenderer(new Bs3FormRenderer()); $form->onSuccess[] = $this->processForm; if ($this->user) { $form->setDefaults(["name" => $this->user->name, "email" => $this->user->email]); } return $form; }
public static function create() { $form = new Form(); $form->setRenderer(new BootstrapVerticalRenderer()); $form->addPassword("password", "Heslo")->setRequired("Zadejte prosím heslo, pomocí kterého se budete přihlašovat.")->addRule(Form::MIN_LENGTH, 'Heslo musí mít alespoň %d znaků', User::MIN_PASSWORD_LENGTH); $form->addPassword("passwordVerify", "Heslo znovu")->setRequired("Zadejte prosím stejné heslo ještě jednou.")->addRule(Form::EQUAL, "Zadaná hesla se musí shodovat", $form["password"]); $form->addSubmit("submit", "Vytvořit heslo")->setAttribute("class", "btn btn-primary btn-lg btn-block"); return $form; }
public function createComponentChangePasswordForm($name) { $form = new Form($this, $name); $form->onSuccess[] = callback($this, $name . 'Submitted'); $form->addPassword('current', 'Zadejte prosím své současné heslo')->setRequired('Vyplnťe prosím své stávající heslo'); $form->addPassword('password', 'Zvolte si prosím své nové heslo')->setRequired('Prosím vyplňte své nové heslo')->addRule(Form::MIN_LENGTH, 'Vaše nové heslo musí být dlouhé nejméně %d znaků.', $this->context->config->get('security.password.minLength', 6)); $form->addPassword('passwordCheck', 'Heslo znovu pro kontrolu:')->setRequired('Prosím vyplňte své druhé helso pro kontrolu.')->addRule(Form::EQUAL, 'Vyplněná hesla se neshodují', $form['password']); $form->addSubmit('s', 'Změnit!'); $form->addProtection(); }
/** * Creates Account Settings Form. * @return Form */ public function create() { $form = new Form(); $form->addPassword('current', 'Current password')->setRequired('%label is required'); $form->addPassword('new', 'New Password')->setRequired('%label is required'); $form->addPassword('confirm', 'Confirm New Password')->setRequired('New password is required')->addRule(Form::EQUAL, 'New passwords must match', $form['new']); $form->addSubmit('submit', 'Change Password'); $form->onSuccess[] = [$this, 'formSucceeded']; return $form; }
/** * @return Nette\Application\UI\Form */ protected function createComponentPasswordForm() { $form = new Form(); $form->addPassword('oldPassword', 'Staré heslo:', 30)->addRule(Form::FILLED, 'Je nutné zadat staré heslo.'); $form->addPassword('newPassword', 'Nové heslo:', 30)->addRule(Form::MIN_LENGTH, 'Nové heslo musí mít alespoň %d znaků.', 6); $form->addPassword('confirmPassword', 'Potvrzení hesla:', 30)->addRule(Form::FILLED, 'Nové heslo je nutné zadat ještě jednou pro potvrzení.')->addRule(Form::EQUAL, 'Zadná hesla se musejí shodovat.', $form['newPassword']); $form->addSubmit('set', 'Změnit heslo'); $form->onSuccess[] = $this->passwordFormSubmitted; return $form; }
/** * Creates a SignUpForm. * @return Form */ public function create() { $form = new Form(); $form->addText('email', 'Email')->setRequired('%label is required')->addRule(Form::EMAIL, 'Invalid email'); $form->addPassword('password', 'Password')->setRequired('%label is required'); $form->addPassword('confirm', 'Confirm Password')->setRequired('%label is required')->addRule(Form::EQUAL, 'Passwords must match', $form['password']); $form->addSubmit('submit', 'Sign Up'); $form->onSuccess[] = [$this, 'formSucceeded']; return $form; }
/** * Formulář na přidání/editaci uživatelů s validačními pravidly. * @return Form */ protected function createComponentUserForm() { $form = new Nette\Application\UI\Form(); $form->addText('username')->setAttribute('placeholder', 'Username')->setAttribute('class', 'form-control')->setRequired('Please enter an username.')->addRule(Form::MIN_LENGTH, 'Username must be at least %d characters long.', 3); $form->addPassword('password')->setAttribute('placeholder', 'Password')->setAttribute('class', 'form-control')->setRequired('Please choose a password.')->addRule(Form::MIN_LENGTH, 'Password must be at least %d characters long.', 6); $form->addPassword('password2')->setAttribute('placeholder', 'Confirm password')->setAttribute('class', 'form-control')->setRequired('Please repeat your password.')->addRule(Form::EQUAL, 'Passwords must match.', $form['password']); $form->addText('email')->setAttribute('placeholder', 'Email address')->setAttribute('class', 'form-control')->setRequired('Please enter an email.')->addRule(Form::EMAIL, 'Email address must be valid.'); $form->addSubmit('send', 'Add user')->setAttribute('class', 'btn btn-lg btn-primary btn-block')->onClick[] = [$this, 'userFormSucceeded']; return $form; }
public function editPass($id) { $this->user_id = $id; $form = new Form(); $form->enableLocalized(); $form->addPassword('password')->setRequired('errors.fill_password')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'password'); $form->addPassword('password2')->setRequired('errors.password_authentication')->setAttribute('class', 'form-control')->addRule(Form::EQUAL, 'errors.passwords_match', $form['password'])->setAttribute('placeholder', 'password_retry'); $form->addSubmit('submit', 'edit')->setAttribute('class', 'btn btn-primary btn-purple btn-flat'); $form->onSuccess[] = $this->success_form_pass; return $form; }
/** * Register form factory. * @return Nette\Application\UI\Form */ protected function createComponentRegisterForm() { $form = new Nette\Application\UI\Form(); $form->addText('login', 'Username:'******'Please choose your username.'); $form->addPassword('password', 'Password:'******'Please choose your password.'); $form->addPassword('password2', 'Confirm password:'******'Please repeat your password.'); $form->addText('email', 'Email:')->setRequired('Please enter your email.'); $form->addSubmit('send', 'Register'); $form->onSuccess[] = array($this, 'registerFormSucceeded'); return $form; }
/** * Vytvori prihlasovaci formular * @return \Nette\Application\UI\Form */ protected function createComponentForm() { $form = new Form(); $form->addPassword('password', 'Heslo')->addRule(Form::MIN_LENGTH, 'Zadané heslo je příliš krátké zadejte heslo alespoň o %d znacích.', 8)->addRule(Form::FILLED, 'Zadejte prosím heslo.'); $form->addPassword('passwordVerify', 'Heslo pro kontrolu')->addConditionOn($form['password'], Form::FILLED)->addRule(Form::FILLED, 'Zadejte prosím heslo ještě jednou pro kontrolu.')->addRule(Form::EQUAL, 'Hesla sa neshodují.', $form['password']); $form->addSubmit('submit', 'Odeslat'); $form->onSuccess[] = function (Form $form) { $this->formSucceeded($form); }; return $form; }
protected function configure(Form $form) { $form->addText('username', 'locale.form.username')->setRequired('locale.form.username_required'); $form->addText('email', 'locale.form.email')->addRule($form::EMAIL, 'locale.form.email_not_in_order')->setRequired('locale.form.email_address'); $form->addText('forename', 'locale.form.forename'); $form->addText('surname', 'locale.form.surname'); $form->addPassword('password', 'locale.form.password'); $form->addPassword('password_confirm', 'locale.form.password_confirm')->setOmitted()->addConditionOn($form['password'], $form::FILLED, 'locale.form.password_confirm_required')->addRule($form::EQUAL, 'locale.form.password_equal', $form['password']); $form->addSubmit('submit', 'locale.form.save'); $this->tryAutoFill($form, $this->item); }
public function create() { $form = new Form(); $form->setRenderer(new BootstrapVerticalRenderer()); $form->addPassword("actualPassword", "Aktuální heslo")->setRequired("Zadej prosím své aktuální heslo.")->addRule(Form::MIN_LENGTH, "Heslo musí mít alespoň %d znaků", \Model\Entities\User::MIN_PASSWORD_LENGTH); $form->addPassword("password", "Nové heslo")->setRequired("Zadej prosím heslo, pomocí kterého se budeš přihlašovat.")->addRule(Form::MIN_LENGTH, "Heslo musí mít alespoň %d znaků", \Model\Entities\User::MIN_PASSWORD_LENGTH); $form->addPassword("passwordVerify", "Nové heslo znovu")->setRequired("Zadej prosím stejné heslo ještě jednou.")->addRule(Form::EQUAL, "Zadaná hesla se musí shodovat", $form["password"]); $form->addSubmit("submit", "Změnit heslo")->setAttribute("class", "btn btn-default btn-lg btn-block"); $form->onSuccess[] = array($this, "passwordChangeFormSucceeded"); return $form; }
protected function createComponentUserForm() { $form = new Form(); $form->addText('email', 'E-mail')->addRule(Form::EMAIL)->setRequired(); $form->addSelect('role', 'Role', [User::ROLE_USER => 'User', User::ROLE_KRYO => 'Kryo', User::ROLE_ADMIN => 'Admin'])->setRequired(); $form->addPassword('password', 'Password')->addRule(Form::MIN_LENGTH, 'Password must be at least %d characters long.', 6)->setRequired(); $form->addPassword('password2', 'Password again')->addRule(Form::EQUAL, 'Passwords are not the same.', $form['password'])->setOmitted(); $form->addSubmit('process', 'Create a new user'); $form->onSuccess[] = $this->userFormSucceeded; return BootstrapForm::makeBootstrap($form); }
protected function configure(Form $form) { $form->addText('username', 'locale.form.username')->setRequired('locale.form.username_required'); $form->addText('email', 'locale.form.email')->addRule($form::EMAIL, 'locale.form.email_not_in_order')->setRequired('locale.form.email_address'); $form->addText('forename', 'locale.form.forename'); $form->addText('surname', 'locale.form.surname'); $form->addPassword('password', 'locale.form.password')->setRequired('locale.form.password_required'); $form->addPassword('password_confirm', 'locale.form.password_confirm')->addRule($form::EQUAL, 'locale.form.password_equal', $form['password'])->setRequired('locale.form.password_confirm_required')->setOmitted(); $form->addText('__anti', '__Anti', null)->setAttribute('style', 'display: none;'); $form->addSubmit('submit', 'locale.form.submit_sign_up'); }
protected function createComponentRegisterForm() { $form = new Nette\Application\UI\Form(); $form->addText('username', 'Uživateľské meno:')->setRequired('Zadaj svoje užívateľské meno')->setAttribute('class', 'registration-form')->addRule(Nette\Application\UI\Form::MIN_LENGTH, 'užívateľské meno musí mať aspoň %d znaky', 3)->addRule(Nette\Application\UI\Form::MAX_LENGTH, 'užívateľské meno musí mať najviac %d znakov', 15); $form->addText('email', 'Email:')->setRequired('Zadaj svoj email')->setAttribute('class', 'registration-form')->addRule(Nette\Application\UI\Form::EMAIL, 'Neplatná emailová adresa.'); $form->addPassword('password', 'Heslo:')->setRequired('Zadaj svoje heslo')->setAttribute('class', 'registration-form')->addRule(Nette\Application\UI\Form::MIN_LENGTH, 'Heslo musí mať aspoň %d znakov.', 8)->addRule(Nette\Application\UI\Form::MAX_LENGTH, 'Heslo musí mať najviac %d znakov.', 16); $form->addPassword('password2', 'Potvrdenie hesla:')->setRequired('Zadaj svoje heslo znovu')->setAttribute('class', 'registration-form')->addRule(Nette\Application\UI\Form::EQUAL, 'Heslá sa nezhodujú.', $form['password']); $form->addSubmit('send', 'Registrovať')->setAttribute('class', 'registration-form'); $form->onSuccess[] = array($this, 'registerFormSucceeded'); return $form; }
/** * Lost password form * @return Form */ public function create() { $form = new Form(); $form->addText('mail', 'Zadejte svůj registrovaný mail')->setRequired('Zadejte svůj mail')->addRule(Form::EMAIL, 'Nesprávný formát mailu')->setType('email'); $form->addPassword('password', 'Vaše přihlašovací heslo po 1.:')->setRequired('Prosím zadejte vaše heslo')->addRule(Form::PATTERN, 'Musí obsahovat číslici', '.*[0-9].*')->addRule(Form::MIN_LENGTH, 'Heslo musí mít alespoň %d znaků', 6); $form->addPassword('password2', 'Vaše přihlašovací heslo po 2.:')->addRule(Form::FILLED, "Potvrzovací heslo musí být vyplněné !")->addConditionOn($form["password"], Form::FILLED)->addRule(Form::EQUAL, "Hesla se musí shodovat !", $form["password"]); $form->addHidden('passwordCheckCode', $this->request->getQuery('id')); $form->addSubmit('renew', 'Nastavit nové heslo'); $form->onSuccess[] = [$this, 'succeeded']; return $form; }
public function createComponentPasswordChangeForm() { $form = new Form(); $form->setRenderer(new \EditFormRenderer()); $form->addGroup('Prihlasovacie údaje'); $form->addPassword('oldPassword', 'Staré heslo:')->addRule(Form::FILLED, 'Vyplň svoje staré heslo'); $form->addPassword('password', 'Nové heslo:')->addRule(Form::FILLED, 'Zadaj nové heslo')->addRule(Form::MIN_LENGTH, 'Heslo musí mať aspoň %d znakov', 8); $form->addPassword('passwordConfirm', 'Heslo ešte raz:')->addRule(Form::EQUAL, 'Heslá sa nezhodujú.', $form['password']); $form->onSuccess[] = callback($this, 'onPasswordChangeSubmit'); $form->addSubmit('submit', 'Zmeň heslo'); return $form; }
public function create(UserManager $userManager, $userId) { $this->userId = $userId; $this->userManager = $userManager; $form = new Form(); $form->addPassword('oldPassword', 'Staré heslo:')->setType('password')->setRequired('Zadejte své staré heslo'); $form->addPassword('password', 'Nové heslo:')->setType('password')->setRequired('Zadejte své nové heslo')->addRule(Form::PATTERN, 'Heslo musí obsahovat číslici', '.*[0-9].*')->addRule(Form::PATTERN, 'Heslo musí obsahovat písmeno', '.*[a-z].*')->addRule(Form::MIN_LENGTH, 'Heslo musí být dlouhé min 6 znaků', 6); $form->addPassword('passwordVerify', 'Heslo pro kontrolu:')->setRequired('Zadejte prosím heslo ještě jednou pro kontrolu')->addRule(Form::EQUAL, 'Hesla se neshodují', $form['password']); $form->addSubmit('passwordChange', 'Změnit heslo'); $form->onSuccess[] = [$this, 'succeeded']; return $form; }
protected function createComponentRegisterForm() { $form = new Nette\Application\UI\Form(); $form->addText('username', 'Username:'******'Musíte si zvolit uživatelské jméno'); $form->addText('email', 'Email')->addRule(\Nette\Application\UI\Form::EMAIL, "E-mail není v platném formátu")->setRequired('Zadejte platný e-mail'); $form->addPassword('password', 'Heslo:')->addRule(\Nette\Application\UI\Form::MIN_LENGTH, "Heslo musí mít minimálně %d znaků.", 6)->setRequired('Musíte si zvolit heslo'); $form->addPassword('verify', 'Kontrola hesla:')->addRule(\Nette\Forms\Form::EQUAL, "Hesla se neshodují", $form["password"])->setRequired('Zadejte heslo ještě jednou'); $form->addSubmit('send', 'Vytvořit účet'); // call method signInFormSucceeded() on success $form->onSuccess[] = $this->registerFormSuccess; return $form; }
/** * @param User $user * @return Form */ public function create(User $user) { $this->user = $user; $form = new Form(); $form->addPassword('currentPassword', 'Aktuální heslo')->setRequired('Zadejte své aktuální heslo'); $form->addPassword('password', 'Nové heslo:')->setRequired('Vyplňte své heslo.')->addRule(Form::MIN_LENGTH, 'Heslo musí mít alespoň %d znaků.', 5)->setAttribute('placeholder', 'Zadejte nové heslo')->setHtmlId('password-input'); $form->addPassword('password2', 'Kontrola hesla:')->setRequired('Vyplňte kontrolu hesla.')->addRule(Form::EQUAL, 'Zadaná hesla se musí shodovat.', $form['password'])->setAttribute('placeholder', 'Znovu zadejte své heslo')->setHtmlId('password-control-input'); $form->addSubmit('save', 'Změnit heslo')->setHtmlId('password-save-button'); $form->addProtection(); $form->onSuccess[] = [$this, 'processChangePassword']; return $form; }
/** * @return \Nette\Application\UI\Form */ protected function createComponentSignUpForm() { $form = new Form(); $form->addText('username', 'Login:'******'Zadejte prosím uživatelské jméno.')->addRule(Form::PATTERN, 'Login musí obsahovat pouze malá písmena bez diakritiky a čísla.', '[a-z_0-9]+')->addRule(Form::MAX_LENGTH, 'Login může být maximálně %d znaků dlouhý', 20); $form->addText('mcname', 'Minecraft jméno:'); $form['span'] = new InfoSpan('', 'Minecraft jméno nemá tvar emailu.', 'icon info'); $form->addPassword('password', 'Heslo:')->addRule(Form::FILLED, 'Zadejte prosím heslo.')->addRule(Form::MIN_LENGTH, 'Heslo musí mít alespoň %d znaků.', 6); $form->addPassword('verify', 'Ověření hesla:')->addRule(Form::EQUAL, 'Hesla se neshodují.', $form['password']); $form->addSubmit('send', 'Registrovat'); $form->onSuccess[] = $this->signUpFormSubmitted; return $form; }
/** * @return Form */ public function createComponentForm() { $form = new Form(); $form->addText('name', 'Name:')->setRequired('Please enter your name.'); $form->addText('email', 'Email:')->setRequired('Please enter your email.')->addRule(Form::EMAIL, 'Please enter valid email address.'); $form->addPassword('password', 'Password:'******'Please enter your password.'); $form->addPassword('password2', 'Password again:')->setRequired('Please enter your password again.')->addRule(Form::EQUAL, 'Passwords are not equal.', $form['password']); $form->addCheckbox('agree', 'Agree with conditions')->addRule(Form::EQUAL, 'You have to agree with our conditions', TRUE); $form->addSubmit('send', 'Register'); $form->onSuccess[] = array($this, 'formSucceeded'); return $form; }
protected function createComponentForm() { $form = new Form(); $form->addText('username', 'Username:'******'Please enter your username.'); $form->addPassword('password', 'Password:'******'Please enter your password.')->addRule(Form::MIN_LENGTH, 'Password must be at least %d characters long', 6)->addRule(Form::MAX_LENGTH, 'Password cannot be longer than %d characters', 32); $form->addPassword('password2', 'Confirm password:'******'Please enter your password.')->addRule(Form::EQUAL, 'Passwords do not match!', $form['password']); $form->addCheckbox('remember', 'Keep me signed in'); $form->addSubmit('send', 'Register'); $form->onSuccess[] = $this->processForm; $this->renderer->render($form); return $form; }
protected function createComponentEditUserForm() { $form = new Form(); $form->addText('username', 'Uživatelské jméno'); $form->addPassword('oldPassword', 'Původní heslo')->setRequired(); $form->addPassword('newPassword', 'Nové heslo'); $form->addPassword('newPasswordVerify', 'Nové heslo pro kontrolu:')->addRule(Form::EQUAL, 'Hesla se neshodují', $form['newPassword']); $form->addSubmit('send', 'Změnit údaje'); $form->onSuccess[] = array($this, 'editUserFormSucceeded'); Helpers::bootstrapForm($form); return $form; }
protected function createComponentForm() { $form = new UI\Form(); $form->addProtection(); $form->addText('username', 'Uživatelské přihlašovací jméno:')->setDefaultValue($this->account->username)->setRequired('Zadejte prosím přihlašovací jméno.'); $form->addPassword('password', 'Nové heslo k tomuto účtu:')->setRequired('Zadejte prosím své stávající, nebo nové heslo.'); $form->addPassword('passwordVerify', 'Heslo pro kontrolu:')->setRequired('Zadejte prosím heslo ještě jednou pro kontrolu.')->addRule(UI\Form::EQUAL, 'Hesla se neshodují.', $form['password']); $form->addSelect('role', 'Role:', $this->roles)->setDefaultValue($this->account->role); $form->addSubmit('save', 'Uložit změny'); $form->onSuccess[] = [$this, 'formSucceeded']; return $form; }
protected function createComponentUserRegistrationForm() { $form = new Form(); $form->addText('username', 'Uživatelské jméno')->setRequired(); $form->addPassword('password', 'Heslo')->setRequired(); $form->addPassword('passwordVerify', 'Heslo pro kontrolu:')->setRequired('Zadejte prosím heslo ještě jednou pro kontrolu')->addRule(Form::EQUAL, 'Hesla se neshodují', $form['password'])->setOmitted(TRUE); $form->addText('email', 'Email')->setRequired()->addRule($form::EMAIL); $form->addSubmit('send', 'Registrovat se'); $form->onSuccess[] = array($this, 'registrationFormSucceeded'); Helpers::bootstrapForm($form); return $form; }
protected function createComponentRegisterForm() { $form = new Form(); $form->addText('email', 'E-mail:')->setRequired(); $form->addPassword('password', 'Helso:')->setRequired(); $form->addPassword('password2', 'Heslo znovu:')->setOmitted(TRUE)->setRule(Form::EQUAL, NULL, $form['password'])->setRequired(); $form->addText('name', 'Celé jméno:')->setRequired(); $form->addCheckbox('terms'); $form->addSubmit('btnRegister', 'Registrovat'); $form->onSuccess[] = $this->registerFormSucceeded; return $form; }
/** * @return Form */ protected function createComponentRegisterForm() { $form = new Form(); $form->addText('username', 'Username')->addRule(Form::MIN_LENGTH, 'Username must be at least 4 characters long.', 4)->addRule(Form::PATTERN, 'Only alphanumeric characters are allowed in username.', "^[a-zA-Z0-9]*\$")->setRequired(); $form->addText('email', 'E-mail')->setRequired(); $form->addPassword('password', 'Password')->addRule(Form::MIN_LENGTH, 'Password must be at least 6 characters long.', 6)->setRequired()->setOption('description', 'Password must be at least 6 characters long.'); $form->addPassword('password2', 'Check password')->setRequired()->addRule(Form::EQUAL, 'Password does not match.', $form['password'])->setOmitted()->setOption('description', 'Enter you password again.'); $form->addText('name', 'Your name'); $form->addSubmit('process', 'Create'); $form->onSuccess[] = $this->registerFormSucceeded; return BootstrapForm::makeBootstrap($form); }