コード例 #1
0
ファイル: RegisterForm.php プロジェクト: kofeinstyle/coc
 public function initialize($entity = null, $options = null)
 {
     // Name
     $name = new Text('name');
     $name->setLabel('Ваше полное имя');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Имя является обязательным параметром'))));
     $this->add($name);
     // Name
     $name = new Text('nickname');
     $name->setLabel('Никнейм в игре');
     $name->setFilters(array('alpha'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Никнейм является обязательным параметром'))));
     $this->add($name);
     // Email
     $email = new Text('email');
     $email->setLabel('E-Mail');
     $email->setFilters(['email']);
     $email->addValidators(array(new PresenceOf(array('message' => 'E-mail является обязательным параметром')), new Email(array('message' => 'E-mail не верный'))));
     $this->add($email);
     // Password
     $password = new Password('password');
     $password->setLabel('Пароль');
     $password->addValidators(array(new PresenceOf(array('message' => 'Пароль является обязательным параметром'))));
     $this->add($password);
     // Confirm Password
     $repeatPassword = new Password('repeatPassword');
     $repeatPassword->setLabel('Повторите пароль');
     $repeatPassword->addValidators(array(new PresenceOf(array('message' => 'Пароль является обязательным параметром'))));
     $this->add($repeatPassword);
 }
コード例 #2
0
 public function initialize()
 {
     //añadimos el campo username
     $username = new Text('username');
     //añadimos la validación para un campo de tipo username y como campo requerido
     $username->addValidators(array(new PresenceOf(array('message' => 'El username es requerido'))));
     //label para el username
     $username->setLabel('Username');
     //hacemos que se pueda llamar a nuestro campo username
     $this->add($username);
     //añadimos el campo password
     $password = new Password('password');
     //añadimos la validación como campo requerido al password
     $password->addValidator(new PresenceOf(array('message' => 'El password es requerido')));
     //label para el Password
     $password->setLabel('Password');
     //hacemos que se pueda llamar a nuestro campo password
     $this->add($password);
     //prevención de ataques csrf, genera un campo de este tipo
     //<input value="dcf7192995748a80780b9cc99a530b58" name="csrf" id="csrf" type="hidden" />
     $randomsting = new Hidden('randomsting');
     //añadimos la validación para prevenir csrf
     /*$csrf->addValidator(
     			new Identical(array(
     				'value' => $this->security->getSessionToken(),
     				'message' => '¡La validación CSRF ha fallado! '.$this->security->getSessionToken()
     			))
     		);
     		*/
     //hacemos que se pueda llamar a nuestro campo csrf
     $this->add($randomsting);
     //añadimos un botón de tipo submit
     $submit = $this->add(new Submit('Login', array('class' => 'button primary')));
 }
コード例 #3
0
 public function initialize()
 {
     //username
     $username = new Text('login');
     $username->setLabel('Login');
     $username->addValidator(new PresenceOf(array("message" => "Login required")));
     $username->setAttributes(array('id' => 'login-username', 'class' => 'form-control', 'placeholder' => 'username'));
     $this->add($username);
     //password
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidator(new PresenceOf(array("message" => "Password required")));
     $password->setAttributes(array('id' => 'login-password', 'class' => 'form-control', 'placeholder' => 'password'));
     $password->clear();
     $this->add($password);
     //remember me
     $remember = new Check('remember', array("value" => '1', "id" => "login-remember"));
     $remember->setLabel('Remember me');
     $this->add($remember);
     //CSRF
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical([$this->security->checkToken() => true, 'message' => 'This request was aborted because it appears to be forged']));
     $this->add($csrf);
     //Submit
     $this->add(new Submit('Sign In', array('class' => 'btn btn-success', 'id' => 'btn-login')));
 }
コード例 #4
0
ファイル: SignUpForm.php プロジェクト: adiachenko/phstart
 public function initialize()
 {
     $email = new Text('email');
     $email->setLabel('Email');
     $email->addValidators([new PresenceOf(['message' => 'The email is required', 'cancelOnFail' => true]), new Email(['message' => 'Must be a valid email'])]);
     $this->add($email);
     $firstName = new Text('first-name');
     $firstName->setLabel('First Name');
     $firstName->addValidators([new PresenceOf(['message' => 'The first name is required', 'cancelOnFail' => true]), new StringLength(['min' => 3, 'max' => 40, 'messageMinimum' => 'The first name is too short. Minimum 3 characters', 'messageMaximum' => 'The first name is too long. Maximum 40 characters'])]);
     $this->add($firstName);
     $lastName = new Text('last-name');
     $lastName->setLabel('Last Name');
     $lastName->addValidators([new PresenceOf(['message' => 'The last name is required', 'cancelOnFail' => true]), new StringLength(['min' => 3, 'max' => 40, 'messageMinimum' => 'The last name is too short. Minimum 3 characters', 'messageMaximum' => 'The last name is too long. Maximum 40 characters'])]);
     $this->add($lastName);
     $middleName = new Text('middle-name');
     $middleName->setLabel('Middle Name');
     $middleName->addValidators([new StringLength(['max' => 40, 'messageMaximum' => 'The middle name is too long. Maximum 40 characters'])]);
     $this->add($middleName);
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators([new PresenceOf(['message' => 'The password is required', 'cancelOnFail' => true]), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters')), new Regex(['pattern' => '/^(?=.*[A-Z])(?=.*[0-9])(?=.*[a-z]).*$/', 'message' => 'The password is not strong enough. It must contain both upper, lowercase characters and at least one digit']), new Confirmation(array('message' => 'The password does not match it\'s confirmation', 'with' => 'password-confirm'))]);
     $this->add($password);
     $confirm = new Password('password-confirm');
     $confirm->setLabel('Confirm password');
     $confirm->addValidators([new PresenceOf(['message' => 'The password confirmation is required'])]);
     $this->add($confirm);
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed')));
     $this->add($csrf);
 }
コード例 #5
0
ファイル: RegisterForm.php プロジェクト: surzm/gohome
 public function initialize($entity = null, $options = null)
 {
     //name
     $name = new Text('name');
     $name->setLabel('Представьтесь или напишите название Вашего приюта:');
     $name->addValidators(array(new PresenceOf(array('message' => 'Обязательное поле'))));
     $this->add($name);
     //email
     $email = new Text('email');
     $email->setLabel('Введите Ваш E-mail:');
     $email->addValidators(array(new PresenceOf(array('message' => 'Обязательное поле')), new Email(array('message' => 'Введите правильный E-mail'))));
     $this->add($email);
     //Phone
     $number = new Text('number');
     $number->setLabel('Напишите телефон, по которому с Вами можно связаться:');
     $number->addValidators(array(new PresenceOf(array('message' => 'Обязательное поле'))));
     $this->add($number);
     //password
     $password = new Password('password');
     $password->setLabel('Придумайте пароль:');
     $password->addValidators(array(new PresenceOf(array('message' => 'Обязательно поле')), new StringLength(array('min' => 8, 'messageMinimum' => 'Слишком короткий, минимум - 8 символов')), new Confirmation(array('message' => 'Пароль не подтвержден', 'with' => 'confirmPassword'))));
     $this->add($password);
     // Confirm Password
     $confirmPassword = new Password('confirmPassword');
     $confirmPassword->setLabel('Подтвердите пароль:');
     $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required'))));
     $this->add($confirmPassword);
     // CSRF
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed')));
     $this->add($csrf);
     // Sign Up
     $this->add(new Submit('Sign Up', array('class' => 'btn btn-success')));
 }
コード例 #6
0
 public function initialize($entity = null, $options = null)
 {
     // Name
     $name = new Text('name');
     $name->setLabel('Полное имя');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Имя вводить обязательно'))));
     $this->add($name);
     // Name
     $name = new Text('username');
     $name->setLabel('Имя пользователя');
     $name->setFilters(array('alpha'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Это обязательное поле'))));
     $this->add($name);
     // Email
     $email = new Text('email');
     $email->setLabel('E-Mail');
     $email->setFilters('email');
     $email->addValidators(array(new PresenceOf(array('message' => 'Без email вы не зарегестрируетесь нигде')), new Email(array('message' => 'Это не настоящий email'))));
     $this->add($email);
     // Password
     $password = new Password('password');
     $password->setLabel('Пароль');
     $password->addValidators(array(new PresenceOf(array('message' => 'Придумайте пароль'))));
     $this->add($password);
     // Confirm Password
     $repeatPassword = new Password('repeatPassword');
     $repeatPassword->setLabel('Повторите пароль');
     $repeatPassword->addValidators(array(new PresenceOf(array('message' => 'Подтвердите свой пароль'))));
     $this->add($repeatPassword);
 }
コード例 #7
0
ファイル: Password.php プロジェクト: mrbubblesort/waitlist
 public function initialize($entity = null, $user_options = array())
 {
     $curr_password = new Element\Password('current_password');
     $curr_password->setLabel('Current Password');
     $curr_password->setFilters(array('striptags', 'trim'));
     $curr_password->addValidators(array(new EveValidator\User\PasswordCheck()));
     $this->add($curr_password);
     $password = new Element\Password('password');
     $password->setLabel('New Password');
     $password->setFilters(array('striptags', 'trim'));
     $password->addValidators(array(new Validator\Regex(array('pattern' => '/[A-Za-z\\d\\W]+/i', 'message' => 'Password must be greater than 6 characters')), new Validator\StringLength(array('max' => 100, 'min' => 6, 'messageMaximum' => 'Password is too long', 'messageMinimum' => 'Password is too short'))));
     $password->setAttributes(array('data-toggle' => 'popover', 'data-content' => 'Password must be greater than 6 characters', 'data-title' => 'Help'));
     $this->add($password);
     $password_again = new Element\Password('password_again');
     $password_again->setLabel('Re-enter New Password');
     $password_again->setFilters(array('striptags', 'trim'));
     $password_again->addValidators(array(new Validator\Confirmation(array('message' => 'Passwords do not match', 'with' => 'password'))));
     $this->add($password_again);
     $submit = new Element\Submit('submit');
     $submit->setLabel('Save');
     $submit->setUserOption('icon', 'user');
     $submit->setAttribute('value', 'Save');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($submit);
 }
コード例 #8
0
 public function initialize($entity = null, $options = null)
 {
     //姓名
     $name = new Text('name');
     $name->setLabel('姓 名');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => '请输入用户的姓名'))));
     $this->add($name);
     //用户名
     $name = new Text('username');
     $name->setLabel('用户名');
     $name->setFilters(array('alpha'));
     $name->addValidators(array(new PresenceOf(array('message' => '请输入用户名'))));
     $this->add($name);
     //邮箱
     $email = new Text('email');
     $email->setLabel('邮 箱');
     $email->setFilters('email');
     $email->addValidators(array(new PresenceOf(array('message' => '请输入邮箱')), new Email(array('message' => '不是有效的邮箱'))));
     $this->add($email);
     //密码
     $password = new Password('password');
     $password->setLabel('密 码');
     $password->addValidators(array(new PresenceOf(array('message' => '请输入密码'))));
     $this->add($password);
     //确认密码
     $repeatPassword = new Password('repeatPassword');
     $repeatPassword->setLabel('二次密码');
     $repeatPassword->addValidators(array(new PresenceOf(array('message' => '请再次输入密码'))));
     $this->add($repeatPassword);
 }
コード例 #9
0
 public function initialize($entity = null, $options = null)
 {
     $name = new Text('name');
     $name->setLabel('Name');
     $name->addValidators(array(new PresenceOf(array('message' => 'The name is required'))));
     $this->add($name);
     //Email
     $email = new Text('email');
     $email->setLabel('E-Mail');
     $email->addValidators(array(new PresenceOf(array('message' => 'The e-mail is required')), new Email(array('message' => 'The e-mail is not valid'))));
     $this->add($email);
     //Password
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters')), new Confirmation(array('message' => 'Password does not match confirmation', 'with' => 'confirmPassword'))));
     $this->add($password);
     //Confirm Password
     $confirmPassword = new Password('confirmPassword');
     $confirmPassword->setLabel('Confirm Password');
     $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required'))));
     $this->add($confirmPassword);
     //Remember
     $terms = new Check('terms', array('value' => 'yes'));
     $terms->setLabel('Accept terms and conditions');
     $terms->addValidator(new Identical(array('value' => 'yes', 'message' => 'Terms and conditions must be accepted')));
     $this->add($terms);
     //CSRF
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed')));
     $this->add($csrf);
     //Sign Up
     $this->add(new Submit('Register', array('class' => 'btn btn-success')));
 }
コード例 #10
0
ファイル: RegisterForm.php プロジェクト: lss233/FiSkinAlcon
 public function initialize($entity = null, $options = null)
 {
     // Name
     $name = new Text('name');
     $name->setLabel('Your Full Name');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Name is required'))));
     $this->add($name);
     // Name
     $name = new Text('username');
     $name->setLabel('Username');
     $name->setFilters(array('alpha'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Please enter your desired user name'))));
     $this->add($name);
     // Email
     $email = new Text('email');
     $email->setLabel('E-Mail');
     $email->setFilters('email');
     $email->addValidators(array(new PresenceOf(array('message' => 'E-mail is required')), new Email(array('message' => 'E-mail is not valid'))));
     $this->add($email);
     // Password
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'Password is required'))));
     $this->add($password);
     // Confirm Password
     $repeatPassword = new Password('repeatPassword');
     $repeatPassword->setLabel('Repeat Password');
     $repeatPassword->addValidators(array(new PresenceOf(array('message' => 'Confirmation password is required'))));
     $this->add($repeatPassword);
 }
コード例 #11
0
ファイル: UsersForm.php プロジェクト: fenghuilee/Talon
 public function initialize($entity = null, $options = null)
 {
     parent::initialize();
     // In edition the id is hidden
     if (isset($options['edit']) && $options['edit']) {
         $id = new Hidden('id');
         $id->addValidators(array(new PresenceOf(array('message' => 'ID missing'))));
         $this->add($id);
     } else {
         // Password
         $password = new Password('password', array('placeholder' => 'Password'));
         $password->setLabel('Password');
         $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters'))));
         $this->add($password);
     }
     $name = new Text('name', array('placeholder' => 'Name'));
     $name->setLabel('Name');
     $name->addValidators(array(new PresenceOf(array('message' => 'The name is required'))));
     $this->add($name);
     $email = new Text('email', array('placeholder' => 'Email'));
     $email->setLabel('Email');
     $email->addValidators(array(new PresenceOf(array('message' => 'The e-mail is required')), new Email(array('message' => 'The e-mail is not valid'))));
     $this->add($email);
     $this->add(new Select('validated', array('1' => 'Yes', '0' => 'No')));
     $this->add(new Select('active', array('1' => 'Yes', '0' => 'No')));
     $this->add(new Submit('Save'));
 }
コード例 #12
0
ファイル: SignUpForm.php プロジェクト: kjmtrue/blog
 public function initialize($entity = null, $options = null)
 {
     if (isset($options['edit']) && $options['edit']) {
         $id = new Hidden('id');
     } else {
         $id = new Text('id');
     }
     $username = new Text('username', array('placeholder' => 'Tran Duy Thien'));
     //<input type="text" value="" id="fullName" name="fullName">
     $username->setLabel('Tên Tài Khoản');
     //<label for="fullName">fullName</label>
     $username->addValidators(array(new PresenceOf(array('message' => 'Tài khoản không được rỗng'))));
     $this->add($username);
     //Password
     $password = new Password('password');
     $password->setLabel('Mật Khẩu');
     $password->addValidators(array(new PresenceOf(array('message' => 'Mật khẩu không được rỗng')), new StringLength(array('min' => 8, 'messageMinimum' => 'Mật khẩu phải lớn hơn 8 ký tự')), new Confirmation(array('message' => 'Mật khẩu không khớp', 'with' => 'confirmPassword'))));
     $this->add($password);
     //Confirm Password
     $confirmPassword = new Password('confirmPassword');
     $confirmPassword->setLabel('Nhập lại mật khẩu');
     $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required'))));
     $this->add($confirmPassword);
     //Remember
     $terms = new Check('terms', array('value' => 'yes'));
     $terms->setLabel('Đồng ý với Điều khoản dịch vụ và chính sách bảo mật của chúng tôi');
     $terms->addValidator(new Identical(array('value' => 'yes', 'message' => 'Bạn chưa chọn')));
     $this->add($terms);
     //CSRF
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed')));
     $this->add($csrf);
     //Sign Up
     $this->add(new Submit('Sign Up', array('class' => 'btn btn-primary pull-right')));
 }
コード例 #13
0
ファイル: LoginForm.php プロジェクト: skybird/EvaUser
 public function initialize($entity = null, $options = null)
 {
     $name = new Text('identify');
     $name->addValidators(array(new PresenceOf(array('message' => 'Please input username or email'))));
     $this->add($name);
     // Password
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 6, 'max' => 26, 'messageMinimum' => 'Password is too short. Minimum 6 characters', 'messageMaximum' => 'Password is too long. Maximum 26 characters'))));
     $this->add($password);
 }
コード例 #14
0
ファイル: LoginForm.php プロジェクト: riquedesimone/biko
 public function initialize()
 {
     $login = new Text('login', array('maxlength' => 16));
     $login->addValidator(new PresenceOf(array('message' => 'User name is required')));
     $login->setLabel('Login');
     $this->add($login);
     $password = new Password('password');
     $password->addValidator(new PresenceOf(array('message' => 'Password is required')));
     $password->setLabel('Password');
     $this->add($password);
 }
コード例 #15
0
ファイル: OAuthLoginForm.php プロジェクト: skybird/phalcon
 public function initialize($entity = null, $options = null)
 {
     $name = new Text('identify');
     $name->addValidators(array(new PresenceOf(array('message' => 'The field is required'))));
     $this->add($name);
     // Password
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters'))));
     $this->add($password);
 }
コード例 #16
0
ファイル: RegisterForm.php プロジェクト: skybird/phalcon
 public function initialize($entity = null, $options = null)
 {
     $name = new Text('username');
     $name->setLabel('Name');
     $name->addValidators(array(new PresenceOf(array('message' => 'Username is required')), new Regex(array('pattern' => '/[0-9a-zA-Z_]+/', 'message' => 'Username is alphanumerics and underline only')), new StringLength(array('min' => 4, 'max' => 24, 'messageMinimum' => 'Username is too short. Minimum 4 characters', 'messageMaximum' => 'Username is too long. Maximum 24 characters'))));
     $this->add($name);
     // Email
     $email = new Text('email');
     $email->setLabel('Email');
     $email->addValidators(array(new PresenceOf(array('message' => 'Email is required')), new Email(array('message' => 'Email is not valid'))));
     $this->add($email);
     // Password
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 6, 'max' => 26, 'messageMinimum' => 'Password is too short. Minimum 6 characters', 'messageMaximum' => 'Password is too long. Maximum 26 characters'))));
     $this->add($password);
     // Confirm Password
     /*
     $confirmPassword = new Password('passwordConfirm');
     $confirmPassword->setLabel('Confirm Password');
     $confirmPassword->addValidators(array(
         new PresenceOf(array(
             'message' => 'The confirmation password is required'
         )),
         new Confirmation(array(
             'message' => 'Password doesn\'t match',
             'with' => 'password'
         ))
     ));
     $this->add($confirmPassword);
     */
     // Remember
     $terms = new Check('agree', array('value' => 'yes'));
     $terms->setLabel('Accept terms and conditions');
     $terms->addValidator(new Identical(array('value' => 'yes', 'message' => 'Terms and conditions must be accepted')));
     $this->add($terms);
     /*
     // CSRF
     $csrf = new Hidden('csrf');
     
     $csrf->addValidator(new Identical(array(
         'value' => $this->security->getSessionToken(),
         'message' => 'CSRF validation failed'
     )));
     
     $this->add($csrf);
     
     // Sign Up
     $this->add(new Submit('Sign Up', array(
         'class' => 'btn btn-success'
     )));
     */
 }
コード例 #17
0
ファイル: ClienteForm.php プロジェクト: zedmaster/ticobox
 public function initialize($entity = null, $options = null)
 {
     // Name
     $name = new Text('nome', ['class' => 'form-control']);
     $name->setLabel('Nome');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'É necessário preencher o Nome'))));
     $this->add($name);
     // Email
     $email = new Text('email', ['class' => 'form-control']);
     $email->setLabel('E-Mail');
     $email->setFilters('email');
     $email->addValidators(array(new PresenceOf(array('message' => 'É necessário preencher o E-mail')), new Email(array('message' => 'Formato de E-mail inválido'))));
     $this->add($email);
     // Password
     $password = new Password('senha', ['class' => 'form-control']);
     $password->setLabel('Senha');
     $password->addValidators(array(new PresenceOf(array('message' => 'É necessário preencher a Senha'))));
     $this->add($password);
     // Confirm Password
     $repeatPassword = new Password('confirmar', ['class' => 'form-control']);
     $repeatPassword->setLabel('Confirmar Senha');
     $repeatPassword->addValidators(array(new PresenceOf(array('message' => 'É necessário preencher Confirmar Senha')), new Confirmation(['message' => 'Erro na Confirmação da Senha', 'with' => 'senha'])));
     $this->add($repeatPassword);
     // CPF
     $cpf = new Text('cpf', ['class' => 'form-control']);
     $cpf->setLabel('CPF');
     $cpf->setFilters(array('striptags', 'string'));
     $cpf->addValidators(array(new PresenceOf(array('message' => 'É necessário preencher o CPF')), new Cpf()));
     $this->add($cpf);
     // RG
     /*
     $rg = new Text('rg', ['class' => 'form-control']);
     $rg->setLabel('RG');
     $rg->setFilters(array('striptags', 'string'));
     $this->add($rg);
     */
     // Telefone
     $telefone = new Text('telefone', ['class' => 'form-control']);
     $telefone->setLabel('Telefone');
     $telefone->setFilters(array('striptags', 'string'));
     $this->add($telefone);
     // Celular
     $celular = new Text('celular', ['class' => 'form-control']);
     $celular->setLabel('celular');
     $celular->setFilters(array('striptags', 'string'));
     $this->add($celular);
     // Submit
     $submit = new Submit('Enviar', ['class' => 'btn btn-default']);
     $submit->setLabel(' ');
     $this->add($submit);
 }
コード例 #18
0
 public function initialize($entity = null, $options = null)
 {
     // Password
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 6, 'messageMinimum' => 'Password is too short. Minimum 6 characters'))));
     $this->add($password);
     // Captcha
     $captcha = new Text('captcha');
     $captcha->setLabel('Captcha');
     $captcha->addValidators(array(new PresenceOf(array('message' => 'The captcha is required'))));
     $this->add($captcha);
 }
コード例 #19
0
ファイル: ResetPasswordForm.php プロジェクト: skybird/phalcon
 public function initialize($entity = null, $options = null)
 {
     // Password
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 6, 'messageMinimum' => 'Password is too short. Minimum 6 characters')), new Confirmation(array('message' => 'Password doesn\'t match confirmation', 'with' => 'passwordConfirm'))));
     $this->add($password);
     // Confirm Password
     $confirmPassword = new Password('passwordConfirm');
     $confirmPassword->setLabel('Confirm Password');
     $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required'))));
     $this->add($confirmPassword);
 }
コード例 #20
0
 public function initialize()
 {
     $username = new Text('username');
     $username->setLabel('用户名');
     $username->addValidators([new PresenceOf(['message' => '用户名必填']), new StringLength(['min' => 4, 'max' => 20, 'messageMinimum' => '用户名长度应大于4', 'messageMaximum' => '用户名长度应小于20'])]);
     $this->add($username);
     $password = new Password('password');
     $password->setLabel('密码');
     $password->addValidators([new PresenceOf(['message' => '密码必填']), new StringLength(['min' => 6, 'messageMinimum' => '密码应大于6个字符'])]);
     $this->add($password);
     $remember = new Check('remember');
     $remember->setLabel('记住登录');
     $this->add($remember);
 }
コード例 #21
0
ファイル: Add.php プロジェクト: mrbubblesort/waitlist
 public function initialize($entity = null, $user_options = array())
 {
     // Login details
     $username = new Element\Text('username');
     $username->setLabel('Email');
     $username->setFilters(array('striptags', 'trim'));
     $username->addValidators(array(new Validator\Email(array('message' => 'This is not a valid email')), new EveValidator\User\Unique(array('message' => 'Email already registered'))));
     $username->setAttributes(array('data-toggle' => 'popover', 'data-content' => 'Enter an email address', 'data-title' => 'Help'));
     $this->add($username);
     $username_again = new Element\Text('username_again');
     $username_again->setLabel('Re-enter email');
     $username_again->setFilters(array('striptags', 'trim'));
     $username_again->addValidators(array(new Validator\Confirmation(array('message' => 'Emails do not match', 'with' => 'username'))));
     $this->add($username_again);
     $password = new Element\Password('password');
     $password->setLabel('Password');
     $password->setFilters(array('striptags', 'trim'));
     $password->addValidators(array(new Validator\Regex(array('pattern' => '/[A-Za-z\\d\\W]+/i', 'message' => 'Password must be greater than 6 characters')), new Validator\StringLength(array('max' => 100, 'min' => 6, 'messageMaximum' => 'Password is too long', 'messageMinimum' => 'Password is too short'))));
     $password->setAttributes(array('data-toggle' => 'popover', 'data-content' => 'Password must be greater than 6 characters', 'data-title' => 'Help'));
     $this->add($password);
     $password_again = new Element\Password('password_again');
     $password_again->setLabel('Re-enter password');
     $password_again->setFilters(array('striptags', 'trim'));
     $password_again->addValidators(array(new Validator\Confirmation(array('message' => 'Passwords do not match', 'with' => 'password'))));
     $this->add($password_again);
     $name = new Element\Text('name');
     $name->setLabel('Name');
     $name->setFilters(array('striptags', 'trim'));
     $this->add($name);
     $teamspeak = new Element\Text('teamspeak');
     $teamspeak->setLabel('Teamspeak');
     $teamspeak->setFilters(array('striptags', 'trim'));
     $this->add($teamspeak);
     $character = new Element\Text('character');
     $character->setLabel('Character name');
     $character->setFilters(array('striptags', 'trim'));
     $character->addValidator(new Validator\PresenceOf(array('message' => 'This field is required')));
     $this->add($character);
     $game_id = new Element\Text('game_id');
     $game_id->setLabel('Character In-Game ID');
     $game_id->setFilters(array('striptags', 'trim'));
     $game_id->addValidator(new Validator\PresenceOf(array('message' => 'This field is required')));
     $this->add($game_id);
     $submit = new Element\Submit('submit');
     $submit->setLabel('Register');
     $submit->setUserOption('icon', 'user');
     $submit->setAttribute('value', 'Register');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($submit);
 }
コード例 #22
0
 /**
  * Form configuration
  */
 public function initialize()
 {
     $t = $this->getDI()->get('translate');
     $passwordMinLength = $this->config->security->passwordMinLength;
     // Password
     $password = new Password('password');
     $password->setLabel($t->gettext('Password'));
     $password->addValidators([new PresenceOf(['message' => $t->gettext('Password is required')]), new StringLength(['min' => $passwordMinLength, 'messageMinimum' => sprintf($t->gettext('Password is too short. Minimum %d characters'), $passwordMinLength)]), new Confirmation(['message' => $t->gettext('Password doesn\'t match confirmation'), 'with' => 'confirmPassword'])]);
     $this->add($password);
     // Confirm Password
     $confirmPassword = new Password('confirmPassword');
     $confirmPassword->setLabel($t->gettext('Confirm Password'));
     $confirmPassword->addValidators([new PresenceOf(['message' => $t->gettext('The confirmation password is required')])]);
     $this->add($confirmPassword);
 }
コード例 #23
0
 public function initialize()
 {
     parent::initialize();
     // Password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->setLabel('New Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters')), new Confirmation(array('message' => 'Password doesn\'t match confirmation', 'with' => 'confirmPassword'))));
     $this->add($password);
     // Confirm Password
     $confirmPassword = new Password('confirmPassword', array('placeholder' => 'Confirm Password'));
     $confirmPassword->setLabel('Confirm New Password');
     $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required'))));
     $this->add($confirmPassword);
     // Sign Up
     $this->add(new Submit('Change Password', array('class' => 'btn btn-success')));
 }
コード例 #24
0
ファイル: SignInForm.php プロジェクト: adiachenko/phstart
 public function initialize()
 {
     $email = new Text('email');
     $email->setLabel('Email');
     $email->addValidators([new PresenceOf(['message' => 'The email is required', 'cancelOnFail' => true]), new Email(['message' => 'Must be a valid email'])]);
     $this->add($email);
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators([new PresenceOf(['message' => 'The password is required', 'cancelOnFail' => true])]);
     $this->add($password);
     $remember = new Check('remember', ['checked' => 'checked']);
     $this->add($remember);
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed')));
     $this->add($csrf);
 }
コード例 #25
0
ファイル: PassForm.php プロジェクト: mpetcu/lime-juice
 public function initialize()
 {
     $pass = new Password("pass");
     $pass->setLabel('Pass');
     $pass->addValidator(new StringLength(array('min' => 6, 'messageMinimum' => '<b>Pass</b> must be at least 6 chars long.')));
     $pass->addValidator(new Confirmation(array('with' => 'pass2', "message" => "<b>Pass</b> and <b>Retype pass</b> does not match.")));
     $this->add($pass);
     $pass2 = new Password("pass2");
     $pass2->setLabel('Retype pass');
     $this->add($pass2);
     $oldpass = new Password("oldPass");
     $oldpass->setLabel('Old pass');
     $oldpass->addValidator(new PresenceOf(['message' => '<strong>Email</strong> address is required.']));
     $this->add($oldpass);
     //$this->setCsrf();
 }
コード例 #26
0
 public function initialize()
 {
     $login = new Text('login', array('required' => true, 'autocomplete' => 'off'));
     $login->setLabel($this->helper->translate('Login'));
     $email = new Email('email', array('required' => true, 'autocomplete' => 'off'));
     $email->addValidator(new ValidatorEmail(array('message' => $this->helper->translate('Email format required'))));
     $email->addValidator(new PresenceOf(array('message' => $this->helper->translate('Email is required'))));
     $email->setLabel('Email');
     $password = new Password('password', array('autocomplete' => 'off'));
     $password->setLabel($this->helper->translate('Password'));
     $active = new Check('active');
     $active->setLabel($this->helper->translate('Active'));
     $this->add($login);
     $this->add($email);
     $this->add($password);
     $this->add($active);
 }
コード例 #27
0
ファイル: LoginForm.php プロジェクト: joszz/Chell-PHP-Portal
 /**
  * Add all fields to the form and set form specific attributes.
  */
 public function initialize()
 {
     $this->_action = $this->config->application->baseUri . 'session/login';
     $username = new Text('username');
     $username->setLabel('Username');
     $username->setFilters(array('striptags', 'string'));
     $username->setAttributes(array('placeholder' => 'Username', 'class' => 'form-control' . ($this->_loginFailed ? ' has-error' : null)));
     $password = new Password('password');
     $password->setLabel('Password');
     $password->setFilters(array('striptags', 'string'));
     $password->setAttributes(array('placeholder' => 'Password', 'class' => 'form-control' . ($this->_loginFailed ? ' has-error' : null)));
     $rememberme = new Check('rememberme');
     $rememberme->setLabel('Remember me');
     $this->add($username);
     $this->add($password);
     $this->add($rememberme);
 }
コード例 #28
0
 public function initialize($entity, $options)
 {
     if ($this->getUserOption('confirmCurrent')) {
         $current = new Password('current-password');
         $current->setLabel('Current password');
         $this->add($current);
     }
     $password = new Password('password');
     $password->setLabel('New password');
     $password->addValidators([new PresenceOf(['message' => 'The password is required', 'cancelOnFail' => true]), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters')), new Regex(['pattern' => '/^(?=.*[A-Z])(?=.*[0-9])(?=.*[a-z]).*$/', 'message' => 'The password is not strong enough. It must contain both upper, lowercase characters and at least one digit']), new Confirmation(array('message' => 'The password does not match it\'s confirmation', 'with' => 'password-confirm'))]);
     $this->add($password);
     $confirm = new Password('password-confirm');
     $confirm->setLabel('Confirm new password');
     $confirm->addValidators([new PresenceOf(['message' => 'The password confirmation is required'])]);
     $this->add($confirm);
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(['value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed']));
     $this->add($csrf);
 }
コード例 #29
0
ファイル: UserForm.php プロジェクト: kengos/phalconCart
 public function initialize($entity = null, $options = [])
 {
     if (!isset($options['edit'])) {
         $element = new Text("id");
         $this->add($element->setLabel("Id"));
     } else {
         $this->add(new Hidden("id"));
     }
     $email = new Text("email");
     $email->setLabel("Email");
     $email->setFilters(['string']);
     $email->addValidators([new PresenceOf(['message' => 'Email is required']), new Email(['message' => 'Email is not valid'])]);
     $this->add($email);
     $password = new Password("password");
     $password->setLabel("Password");
     $password->setFilters(['string']);
     $password->addValidators([new PresenceOf(['message' => 'Password is required'])]);
     $this->add($password);
 }
コード例 #30
0
ファイル: SignUpForm.php プロジェクト: fenghuilee/Talon
 public function initialize()
 {
     parent::initialize();
     $name = new Text('name', array('placeholder' => 'Name'));
     $name->setLabel('Name');
     $name->addValidators(array(new PresenceOf(array('message' => 'The name is required'))));
     $this->add($name);
     // Email
     $email = new Text('email', array('placeholder' => 'Email'));
     $email->setLabel('Email');
     $email->addValidators(array(new PresenceOf(array('message' => 'The e-mail is required')), new Email(array('message' => 'The e-mail is not valid')), new Confirmation(array('message' => 'Email doesn\'t match confirmation', 'with' => 'confirmEmail'))));
     $this->add($email);
     // Confirm Email
     $confirmEmail = new Text('confirmEmail', array('placeholder' => 'Confirm Email'));
     $confirmEmail->setLabel('Confirm Email');
     $confirmEmail->addValidators(array(new PresenceOf(array('message' => 'The confirmation e-mail is required'))));
     $this->add($confirmEmail);
     // Password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters')), new Confirmation(array('message' => 'Password doesn\'t match confirmation', 'with' => 'confirmPassword'))));
     $this->add($password);
     // Confirm Password
     $confirmPassword = new Password('confirmPassword', array('placeholder' => 'Confirm Password'));
     $confirmPassword->setLabel('Confirm Password');
     $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required'))));
     $this->add($confirmPassword);
     // Remember
     //		$terms = new Check('terms', array(
     //			'value' => 'yes'
     //		));//
     //		$terms->setLabel('Accept terms and conditions');
     //
     //		$terms->addValidator(new Identical(array(
     //			'value' => 'yes',
     //			'message' => 'Terms and conditions must be accepted'
     //		)));
     //
     //		$this->add($terms);
     // Sign Up
     $this->add(new Submit('Sign Up', array('class' => 'btn btn-success')));
 }