Пример #1
0
 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);
 }
Пример #2
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('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);
 }
Пример #3
0
 public function initialize()
 {
     $this->add(new Text("firstname"));
     $lastname = new Text("lastname");
     $this->add($lastname);
     $username = new Text("username");
     $username->setFilters(array('striptags', 'string'));
     $username->addValidators(array(new PresenceOf()));
     $this->add($username);
     // password
     $password = new Password('password');
     $password->addValidator(new PresenceOf(array('message' => 'password')));
     $this->add($password);
     $this->add(new Text("avatar"));
     $email = new Text("email");
     $email->addValidators(array(new PresenceOf(), new Email()));
     $this->add($email);
     $this->add(new Select('gender', array('0' => 'Nữ', '1' => 'Nam')));
     $this->add(new Text("birthday"));
     $this->add(new Text("address"));
     $this->add(new Text("phone"));
     $this->add(new Select('gender', array('0' => 'Không', '1' => 'Có')));
     $this->add(new Select('status', array('0' => 'Không', '1' => 'Có'), array('class' => 'medium')));
     $department_id = new Select('department_id', \Modules\Backend\Models\Member_department::find(), array('using' => array('id', 'name'), 'class' => 'medium'));
     $this->add($department_id);
     $group_id = new Select('group_id', \Modules\Backend\Models\Permission_group::find(), array('using' => array('id', 'name'), 'class' => 'medium'));
     $this->add($group_id);
 }
Пример #4
0
 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'));
 }
Пример #5
0
 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')));
 }
 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')));
 }
Пример #7
0
 public function initialize()
 {
     // Username
     $username = new Text('username', ['placeholder' => 'Username']);
     $username->addValidator(new PresenceOf(['message' => 'The username is required']));
     $this->add($username);
     // Password
     $password = new Password('password', ['placeholder' => 'Password']);
     $password->addValidator(new PresenceOf(['message' => 'The password is required']));
     $this->add($password);
     // Remember
     $remember = new Check('remember', ['value' => 'yes']);
     $remember->setLabel('Remember me');
     $this->add($remember);
     /*// CSRF
             $csrf = new Hidden('csrf');
     
             $csrf->addValidator(new Identical(array(
                 'value' => $this->security->getSessionToken(),
                 'message' => 'CSRF validation failed'
             )));
     
             $this->add($csrf);
     
             $this->add(new Submit('go', array(
                 'class' => 'btn btn-success'
             )));*/
 }
Пример #8
0
 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);
 }
Пример #9
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);
 }
Пример #10
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')));
 }
Пример #11
0
 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);
 }
Пример #12
0
 public function initialize()
 {
     $login = new Text('login');
     $login->addValidator(new PresenceOf(array('message' => $this->helper->translate('Login is required'))));
     $password = new Password('password');
     $password->addValidator(new PresenceOf(array('message' => $this->helper->translate('Password is required'))));
 }
Пример #13
0
 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')));
 }
Пример #14
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);
 }
Пример #15
0
 /**
  * @param object $entity
  * @param array $options
  */
 public function initialize($entity = null, $options = null)
 {
     //Name
     $name = new Text('name', array('placeholder' => 'Full name'));
     $name->setLabel('Name');
     $name->addValidators(array(new PresenceOf(array('message' => 'The name is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Name is too short. Minimum 8 characters'))));
     $this->add($name);
     //Username
     $username = new Text('login', array('placeholder' => 'Username'));
     $username->addValidators(array(new PresenceOf(array('message' => 'The username is required', 'cancelOnFail' => true)), new StringLength(array('min' => 5, 'messageMinimum' => 'Username is too short. Minimum 5 characters'))));
     $this->add($username);
     //Password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required', 'cancelOnFail' => true)), 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', 'cancelOnFail' => true));
     $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')));
 }
Пример #16
0
 /**
  * attach the password field with validators
  */
 protected function attachPassword()
 {
     $password = new Password('password');
     $password->addValidator(new PresenceOf(['message' => 'The password is required']));
     $password->clear();
     $this->password = $password;
     $this->formElements['password'] = $password;
 }
Пример #17
0
 public function initialize()
 {
     $password = new Password('password');
     $password->addValidators([new PresenceOf(['message' => 'ERR_USER_NEW_PASSWORD_REQUIRED']), new StringLength(['min' => 6, 'messageMinimum' => 'ERR_USER_NEW_PASSWORD_TOO_SHORT_MIN_6']), new NotSameValidator(['message' => 'ERR_USER_PASSWORD_OLD_AND_NEW_THE_SAME', 'with' => 'oldPassword'])]);
     $this->add($password);
     $oldPassword = new Password('oldPassword');
     $oldPassword->addValidators([new PresenceOf(['message' => 'ERR_USER_OLD_PASSWORD_REQUIRED']), new OldPasswordValidator()]);
     $this->add($oldPassword);
 }
Пример #18
0
 public function initialize()
 {
     $login = new Text('login', array('required' => true, 'placeholder' => 'Enter login'));
     $login->addValidator(new PresenceOf(array('message' => 'Login is required')));
     $this->add($login);
     $password = new Password('password', array('required' => true));
     $password->addValidator(new PresenceOf(array('message' => 'Password is required')));
     $this->add($password);
 }
Пример #19
0
 public function initialize()
 {
     $name = new Text('name', array('placeholder' => 'Name', 'class' => 'form-control'));
     $name->addValidators(array(new PresenceOf(array('message' => 'The name is required'))));
     $this->add($name);
     $password = new Password('password', array('placeholder' => 'Password', 'class' => 'form-control'));
     $password->addValidator(new PresenceOf(array('message' => 'The password is required')));
     $this->add($password);
     $this->add(new Submit('log in', array('class' => 'btn btn-success')));
 }
Пример #20
0
 public function initialize()
 {
     //Password
     $password = new Password('password');
     $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->addValidators(array(new PresenceOf(array('message' => 'Подтверждение пароля обязательно'))));
     $this->add($confirmPassword);
 }
Пример #21
0
 public function initialize()
 {
     // Password
     $password = new Password('password');
     $password->addValidators(array(new PresenceOf(array('message' => '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');
     $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required'))));
     $this->add($confirmPassword);
 }
Пример #22
0
 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);
 }
Пример #23
0
 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);
 }
Пример #24
0
 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);
 }
Пример #25
0
 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'
     )));
     */
 }
Пример #26
0
 public function initialize()
 {
     // username
     $username = new Text('username', array('placeholder' => 'Username or Email'));
     $username->addValidators(array(new PresenceOf(array('message' => 'The e-mail is required'))));
     $this->add($username);
     // Password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->addValidator(new PresenceOf(array('message' => 'The password is required')));
     $this->add($password);
     $this->add(new Submit('go', array('class' => 'btn btn-success', 'value' => 'Login')));
 }
Пример #27
0
 public function initialize()
 {
     //Username
     $login = new Text('login', array('placeholder' => 'Username'));
     $login->addValidators(array(new PresenceOf(array('message' => 'The username is required'))));
     $this->add($login);
     //Password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->addValidator(new PresenceOf(array('message' => 'The password is required')));
     $this->add($password);
     $this->add(new Submit('Log In', array('class' => 'btn btn-success')));
 }
Пример #28
0
 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);
 }
Пример #29
0
 public function initialize()
 {
     $userName = new Text('userName');
     $userName->addValidator(new PresenceOf(array('message' => 'User name is required')));
     $password = new Password('password');
     $password->addValidator(new PresenceOf(array('message' => 'Password is required')));
     $email = new Text('email');
     $email->addValidator(new PresenceOf(array('message' => 'Email is required')));
     $email->addValidator(new Email(array('message' => 'Email is not valid')));
     $this->add($userName);
     $this->add($password);
     $this->add($email);
 }
Пример #30
-1
 /**
  * Init user form
  *
  * @param \ZCMS\Core\Models\Users $data
  */
 public function initialize($data = null)
 {
     //Add first name
     $firstName = new Text('first_name', ['maxlength' => '32']);
     $firstName->addValidator(new PresenceOf());
     $this->add($firstName);
     //Add last name
     $lastName = new Text('last_name', ['maxlength' => '32']);
     $lastName->addValidator(new PresenceOf());
     $this->add($lastName);
     //Add email
     if ($data = null) {
         $email = new Email('email', ['maxlength' => '128', 'readonly' => 'readonly']);
     } else {
         $email = new Email('email', ['maxlength' => '128']);
     }
     $this->add($email);
     //Add active
     $is_active = new Select('is_active', ['1' => __('gb_yes'), '0' => __('gb_no')]);
     $this->add($is_active);
     //Add password confirmation
     $password_confirmation = new Password('password_confirmation', ['maxlength' => '32']);
     $password_confirmation->addValidator(new StringLength(['min' => 6]));
     $this->add($password_confirmation);
     //Add password
     $password = new Password('password', ['maxlength' => '32']);
     $password->addValidator(new StringLength(['min' => 6]));
     $password->addValidator(new Confirmation(['message' => 'm_system_user_message_password_does_not_match_confirmation', 'with' => 'password_confirmation']));
     $this->add($password);
     //Add role
     $dbRoles = UserRoles::find(['conditions' => 'is_super_admin = 0', 'order' => 'is_default DESC']);
     $role = new Select('role_id', $dbRoles, ['using' => ['role_id', 'name']]);
     $role->addValidator(new InclusionIn(['message' => 'm_system_user_message_please_choose_role', 'domain' => array_column($dbRoles->toArray(), 'role_id')]));
     $this->add($role);
 }