Пример #1
0
 /**
  * Set a csrf token for all forms
  *
  * @return Hidden
  */
 protected function attachCsrf()
 {
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(['value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed']));
     $csrf->clear();
     return $csrf;
 }
Пример #2
0
 public function initialize()
 {
     //email
     $email = new Text('email', array('placeholder' => 'Email'));
     $email->addValidators(array(new PresenceOf(array('message' => 'Введите Ваш E-mail'))));
     $this->add($email);
     //password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->addValidators(array(new PresenceOf(array('message' => 'Введите пароль'))));
     $password->clear();
     $this->add($password);
     // 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('go', array('class' => 'btn btn-success')));
 }
Пример #3
0
 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')));
     $password->clear();
     $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 validation failed')));
     $csrf->clear();
     $this->add($csrf);
     $this->add(new Submit('go', array('class' => 'btn btn-success')));
 }
Пример #4
0
 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')));
 }