コード例 #1
0
ファイル: LoginForm.php プロジェクト: fenghuilee/writepress
 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'
             )));*/
 }
コード例 #2
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')));
 }
コード例 #3
0
ファイル: Member.php プロジェクト: quyquoc/rmt-studio.com
 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()
 {
     //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')));
 }
コード例 #5
0
ファイル: LoginForm.php プロジェクト: 101010111100/yona-cms
 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'))));
 }
コード例 #6
0
ファイル: LoginBase.php プロジェクト: adrianeavaz/manager.io
 /**
  * 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;
 }
コード例 #7
0
ファイル: LoginForm.php プロジェクト: devsnippet/yona-cms
 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);
 }
コード例 #8
0
ファイル: LoginForm.php プロジェクト: argentum88/phad
 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')));
 }
コード例 #9
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);
 }
コード例 #10
0
ファイル: Login.php プロジェクト: quyquoc/rmt-studio.com
 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')));
 }
コード例 #11
0
ファイル: LoginForm.php プロジェクト: asha1412/dasshy
 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')));
 }
コード例 #12
0
 public function initialize()
 {
     //New password
     $passwordNew = new Password('password_new', array('placeholder' => 'New password', 'class' => 'form-control', 'autocomplete' => 'off'));
     $passwordNew->addValidators(array(new PresenceOf(array('message' => 'Password is required')), new StringLength(array('min' => 5, 'messageMinimum' => 'Password is too short. Minimum 5 characters')), new Confirmation(array('message' => 'Password doesn\'t match confirmation', 'with' => 'password_new_confirm'))));
     $this->add($passwordNew);
     //Confirm New Password
     $passwordNewConfirm = new Password('password_new_confirm', array('placeholder' => 'Confirm new password', 'class' => 'form-control', 'autocomplete' => 'off'));
     $passwordNewConfirm->addValidator(new PresenceOf(array('message' => 'The confirmation password is required')));
     $this->add($passwordNewConfirm);
     //Submit
     $this->add(new Submit('change', ['class' => 'submit-button-login', 'value' => 'Sign in']));
 }
コード例 #13
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);
 }
コード例 #14
0
 public function initialize()
 {
     $environment = $this->config['application']['debug'] ? 'development' : 'production';
     $baseUri = $this->config['application'][$environment]['staticBaseUri'];
     $this->setAction($baseUri . 'session/start/');
     $username = new Text('username');
     $username->addValidator(new PresenceOf(array('message' => 'Can\'t be empty')));
     $password = new Password('password');
     $password->addValidator(new PresenceOf(array('message' => 'Can\'t be empty')));
     $submit = new Submit('login', array('value' => 'Login'));
     $this->add($username);
     $this->add($password);
     $this->add($submit);
 }
コード例 #15
0
ファイル: LoginForm.php プロジェクト: robinxiong/cmsdb
 public function initialize()
 {
     // Email
     $email = new Text('email', array('placeholder' => '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);
     // Password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->addValidator(new PresenceOf(array('message' => 'The password is required')));
     $this->add($password);
     // Remember
     $remember = new Check('remember', array('value' => 'yes'));
     $remember->setLabel('Remember me');
     $this->add($remember);
     $this->add(new Submit('go', array('class' => 'btn btn-success')));
 }
コード例 #16
0
 public function initialize()
 {
     $email = new Text('email', array('placeholder' => 'Email', 'class' => 'form-control'));
     $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 = new Password('password', array('placeholder' => 'Password', 'class' => 'form-control'));
     $password->addValidator(new PresenceOf(array('message' => 'The password is required')));
     $this->add($password);
     $remember = new Check('remember', array('value' => 'yes'));
     $remember->setLabel('Remember me');
     $this->add($remember);
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed')));
     $this->add($csrf);
     $this->add(new Submit('Sing in', array('class' => 'btn btn-lg btn-primary btn-block')));
 }
コード例 #17
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();
 }
コード例 #18
0
 public function initialize()
 {
     //current password
     $passwd = new Password('passwd', array('placeholder' => t('Enter your current password'), 'class' => 'form-control', 'autofocus' => true, 'autocomplete' => 'off'));
     $passwd->addValidator(new PresenceOf(array('message' => t('We need your current password.'))));
     $this->add($passwd);
     //New password
     $passwdNew = new Password('passwd_new', array('placeholder' => t('New password'), 'class' => 'form-control', 'autocomplete' => 'off'));
     $passwdNew->addValidators(array(new PresenceOf(array('message' => t('Password is required'))), new StringLength(array('min' => 5, 'messageMinimum' => t('Password is too short. Minimum 5 characters'))), new Confirmation(array('message' => t('Password doesn\'t match confirmation'), 'with' => 'passwd_new_confirm'))));
     $this->add($passwdNew);
     //Confirm New Password
     $passwdNewConfirm = new Password('passwd_new_confirm', array('placeholder' => t('Confirm new password'), 'class' => 'form-control', 'autocomplete' => 'off'));
     $passwdNewConfirm->addValidator(new PresenceOf(array('message' => t('The confirmation password is required'))));
     $this->add($passwdNewConfirm);
     //Submit
     $this->add(new Submit('save', ['class' => 'button color small submit', 'value' => t('Save')]));
 }
コード例 #19
0
ファイル: LoginForm.php プロジェクト: Pablo251/Kangoo
 public function initialize($entity = null, $options = null)
 {
     // Username
     $username = new Text('username', array('placeholder' => 'Username'));
     $username->addValidators(array(new PresenceOf(array('message' => 'The username is required'))));
     $this->add($username);
     // Password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->addValidator(new PresenceOf(array('message' => 'The password is required')));
     $password->clear();
     $this->add($password);
     // Remember
     $remember = new Check('remember', array('value' => 'false'));
     $remember->setLabel('Remember me');
     $this->add($remember);
     $this->add(new Submit('Continue', array('class' => 'btn btn-success', 'id' => 'submitbtn')));
 }
コード例 #20
0
 public function initialize()
 {
     //Phalcon\Forms\Element
     //public __construct (string $name, [array $attributes])
     $email = new Text('email', array('placeholder' => 'Email'));
     $email->addValidators(array(new PresenceOf(array('message' => 'The email is required')), new Email(array('message' => 'The email is not valid'))));
     $this->add($email);
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->addValidator(new PresenceOf(array('message' => 'The password is required')));
     $this->add($password);
     $remember = new Check('remember', array('value' => 'yes'));
     $remember->setLabel('Remember me');
     $this->add($remember);
     //Cross-Site Request Forgery
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CsrF validation failed')));
     $this->add($csrf);
     $this->add(new Submit('signin', array('class' => 'btn btn-lg btn-primary btn-block')));
 }
コード例 #21
0
ファイル: SigninForm.php プロジェクト: JanOschii/webird
 /**
  * Form configuration
  */
 public function initialize()
 {
     $t = $this->getDI()->get('translate');
     // Email
     $email = new Text('email', ['placeholder' => $t->gettext('Email')]);
     $email->addValidators([new PresenceOf(['message' => $t->gettext('Email is required')]), new Email(['message' => $t->gettext('Email is not valid')])]);
     $this->add($email);
     // Password
     $password = new Password('password', ['placeholder' => $t->gettext('Password')]);
     $password->addValidator(new PresenceOf(['message' => $t->gettext('Password is required')]));
     $this->add($password);
     // Remember
     $remember = new Check('remember', ['value' => $t->gettext('yes')]);
     $remember->setLabel($t->gettext('Remember me'));
     $this->add($remember);
     // Submit
     $submit = new Submit('submit', ['value' => $t->gettext('Go')]);
     $this->add($submit);
 }
コード例 #22
0
ファイル: LoginForm.php プロジェクト: devsnippet/city_site
 public function initialize()
 {
     //Email
     $email = new Text('email', array('placeholder' => 'Email'));
     $email->addValidators(array(new PresenceOf(array('message' => 'Адрес электронной почты обязателен')), new Email(array('message' => 'Не верный адрес электронной почты'))));
     $this->add($email);
     //Password
     $password = new Password('password', array('placeholder' => 'Пароль'));
     $password->addValidator(new PresenceOf(array('message' => 'Пароль обязателен')));
     $this->add($password);
     //Remember
     $remember = new Check('remember', array('value' => 'yes'));
     $remember->setLabel('Запомнить меня');
     $this->add($remember);
     //CSRF
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'сработала защита от CSRF')));
     $this->add($csrf);
     $this->add(new Submit('Войти', array('class' => 'btn btn-success')));
 }
コード例 #23
0
ファイル: LoginForm.php プロジェクト: kjmtrue/blog
 public function initialize()
 {
     //Email
     $email = new Text('email', array('placeholder' => 'Email'));
     $email->addValidators(array(new PresenceOf(array('message' => 'Khong duoc rong')), new Email(array('message' => 'Định dạng email không đùng'))));
     $this->add($email);
     //Password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->addValidator(new PresenceOf(array('message' => 'Mat khau khong dung')));
     $this->add($password);
     //Remember
     $remember = new Check('remember', array('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 Khong chuan')));
     $this->add($csrf);
     $this->add(new Submit('go', array('class' => 'btn btn-success')));
 }
コード例 #24
0
ファイル: SignUp.php プロジェクト: maniolek/demo
 public function initialize()
 {
     $email = new Text('email');
     $email->addValidator(new PresenceOf());
     $email->addValidator(new EmailValidator());
     $email->setAttribute('placeholder', '*****@*****.**');
     $email->setAttribute('class', 'col-xs-12');
     $email->setLabel($this->i18n->_('Email'));
     $this->add($email);
     $password = new Password('raw_password');
     $password->addValidator(new PresenceOf());
     $password->setLabel($this->i18n->_('Password'));
     $password->setAttribute('class', 'col-xs-12');
     $this->add($password);
     $rePassword = new Password('repassword');
     $rePassword->addValidator(new PresenceOf());
     $rePassword->setLabel($this->i18n->_('Re-type Password'));
     $rePassword->setAttribute('class', 'col-xs-12');
     $this->add($rePassword);
 }
コード例 #25
0
ファイル: LoginForm.php プロジェクト: kjmtrue/phanbook
 public function initialize()
 {
     //Email
     $email = new Text('email', ['class' => 'text-box', 'required' => 'true', 'autofocus' => 'true', 'placeholder' => 'Username or Email']);
     $email->addValidators([new PresenceOf(['message' => t('The e-mail is required')])]);
     $this->add($email);
     //Password
     $password = new Password('password', ['placeholder' => t('Password'), 'class' => 'text-box', 'required' => 'true']);
     $password->addValidator(new PresenceOf(['message' => t('The password is required')]));
     $this->add($password);
     //Remember me
     $remember = new Check('remember', ['value' => 'yes', 'checked' => 'checked']);
     $this->add($remember);
     // CSRF
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => t('CSRF validation failed'))));
     $this->add($csrf);
     //Submit
     $this->add(new Submit('login', ['class' => 'submit-button-login', 'value' => t('Login')]));
 }
コード例 #26
0
ファイル: LoginForm.php プロジェクト: hinjanobara/mbimages
 public function initialize()
 {
     $translate = $this->getDi()->get('translate');
     //Email
     $email = new Text('email', array('placeholder' => $translate['Email']));
     $email->addValidators(array(new PresenceOf(array('message' => $translate['The e-mail is required'])), new Email(array('message' => $translate['The e-mail is not valid']))));
     $this->add($email);
     //Password
     $password = new Password('password', array('placeholder' => $translate['Password']));
     $password->addValidator(new PresenceOf(array('message' => $translate['The password is required'])));
     $this->add($password);
     //Remember
     $remember = new Check('remember', array('value' => 'yes'));
     $remember->setLabel($translate['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')));
 }
コード例 #27
0
 public function initialize()
 {
     //current password
     $passwd = new Password('passwd', array('placeholder' => t('Enter your current password'), 'class' => 'form-control', 'autofocus' => true, 'autocomplete' => 'off'));
     $passwd->addValidator(new PresenceOf(array('message' => t('We need your current password.'))));
     $this->add($passwd);
     //New password
     $passwdNew = new Password('passwd_new', array('placeholder' => t('New password'), 'class' => 'form-control', 'autocomplete' => 'off'));
     $passwdNew->addValidators(array(new PresenceOf(array('message' => t('Password is required'))), new StringLength(array('min' => 5, 'messageMinimum' => t('Password is too short. Minimum 5 characters'))), new Confirmation(array('message' => t('Password doesn\'t match confirmation'), 'with' => 'passwd_new_confirm'))));
     $this->add($passwdNew);
     //Confirm New Password
     $passwdNewConfirm = new Password('passwd_new_confirm', array('placeholder' => t('Confirm new password'), 'class' => 'form-control', 'autocomplete' => 'off'));
     $passwdNewConfirm->addValidator(new PresenceOf(array('message' => t('The confirmation password is required'))));
     $this->add($passwdNewConfirm);
     // CSRF
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => t('CSRF validation failed'))));
     $this->add($csrf);
     //Submit
     $this->add(new Submit('save', ['class' => 'btn btn-info btm-sm', 'value' => t('Save')]));
 }
コード例 #28
0
ファイル: UserProfileForm.php プロジェクト: kimthangatm/zcms
 /**
  * Init form
  *
  * @param \ZCMS\Core\Models\Users $user
  */
 public function initialize($user = null)
 {
     //First name
     $firstName = new Text('first_name', ['maxlength' => '32', 'required' => 'required']);
     $this->add($firstName);
     //Last name
     $lastName = new Text('last_name', ['maxlength' => '32', 'required' => 'required']);
     $this->add($lastName);
     //Email
     $email = new Email('email', ['maxlength' => '128', 'required' => 'required', 'readonly' => 'readonly']);
     $this->add($email);
     //Current password
     $currentPassword = new Password('current_password', ['maxlength' => '32']);
     $this->add($currentPassword);
     //Password
     $password = new Password('password', ['maxlength' => '32']);
     $password->addValidator(new Confirmation(['message' => 'm_user_message_confirm_password_not_match', 'with' => 'password_confirmation']));
     $this->add($password);
     //Password confirmation
     $password_confirmation = new Password('password_confirmation', ['maxlength' => '32']);
     $this->add($password_confirmation);
 }
コード例 #29
0
ファイル: LoginForm.php プロジェクト: sbarrios/exclie_soap
 public function initialize()
 {
     // Email
     $email = new Text('email', array('placeholder' => 'Correo Electrónico'));
     $email->addValidators(array(new PresenceOf(array('message' => 'Correo es obligatorio')), new Email(array('message' => 'El Correo no es válido'))));
     $this->add($email);
     // Password
     $password = new Password('password', array('placeholder' => 'Contraseña'));
     $password->addValidator(new PresenceOf(array('message' => 'La contraseña es obligatoria')));
     $password->clear();
     $this->add($password);
     // Remember
     $remember = new Check('remember', array('value' => 'yes'));
     $remember->setLabel('Recuerdame');
     $this->add($remember);
     // CSRF
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed')));
     $csrf->clear();
     $this->add($csrf);
     $this->add(new Submit('Entrar', array('class' => 'btn btn-success')));
 }
コード例 #30
-1
ファイル: UserForm.php プロジェクト: kimthangatm/zcms
 /**
  * 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);
 }