Пример #1
0
 protected function createComponentPasswordForm()
 {
     $form = new BaseaccountForm($this, 'passwordForm');
     $form->addPassword('password', null, 30)->setAttribute('placeholder', 'Current password')->setRequired('Enter the current password please.')->addRule(Form::MIN_LENGTH, 'Password must contain at least %d characters.', 6);
     $form->addPassword('newPassword', null, 30)->setAttribute('placeholder', 'New password')->setRequired('Enter a new password please.')->addRule(Form::NOT_EQUAL, 'New password must be different from the old one.', $form['password'])->addRule(Form::MIN_LENGTH, 'Password must contain at least %d characters.', 6);
     $form->addPassword('verifyPassword', null, 30)->setAttribute('placeholder', 'Retype new password')->setRequired('Reenter a new password please.')->addRule(Form::EQUAL, 'Passwords do not match.', $form['newPassword']);
     $form->addProtection('Time limit has expired. Please send the form again.', 1800);
     $form->onSuccess[] = $this->passwordFormSubmitted;
     $form->addSubmit('edit', 'Edit')->setAttribute('class', 'button');
     return $form;
 }
Пример #2
0
 protected function createComponentSignupForm()
 {
     $form = new BaseaccountForm($this, 'signupForm');
     // credentials part
     $form->addText('username', null, 30, 30)->setAttribute('placeholder', 'Username')->addRule(Form::MIN_LENGTH, 'Username must contain at least %d characters.', 3)->addRule(Form::MAX_LENGTH, 'Username is too long. Use maximum of %d characters.', 60)->addRule(Form::PATTERN, 'Username can contain only alphabetical characters or underscore.', '\\w{3,60}');
     $form->addText('email', 'Email', 30, 30)->setAttribute('placeholder', 'Email')->setRequired('Enter an email please.')->addRule(Form::MAX_LENGTH, 'Email is too long. Use maximum of %d characters.', 255)->addRule(Form::EMAIL, 'Invalid email address.');
     $form->addPassword('password', null, 30)->setAttribute('placeholder', 'Password')->setRequired('Enter a password please.')->addRule(Form::MIN_LENGTH, 'Password must contain at least %d characters.', 6);
     $form->addPassword('verifyPassword', null, 30)->setAttribute('placeholder', 'Retype password')->setRequired('Reenter a password please.')->addRule(Form::EQUAL, 'Passwords do not match.', $form['password']);
     $form->addCheckbox('remember', 'Remember me');
     // shift pattern part
     $sysPatternSelection = $this->sysPatternFacade->getFormSelection();
     $form->addSelect('sysPatternSelect', 'Select pattern', $sysPatternSelection);
     reset($sysPatternSelection);
     $defaultPattern = $this->buildDefaultInputPattern(\Nette\Utils\Json::decode(key($sysPatternSelection)));
     $form['patternInput'] = $this->patternInputOverviewFactory->create();
     $form['patternInput']->setDefaultValue($defaultPattern);
     $form->addSubmit('createAccount', 'Create account')->setAttribute('class', 'button');
     // common part
     $form->addProtection('Time limit has expired. Please send the form again.', 1800);
     $form->onSuccess[] = $this->signupFormSubmitted;
     return $form;
 }