CustomRegisterUserForm.class.php 1.38 KB
Newer Older
Яков's avatar
first  
Яков committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
class CustomRegisterUserForm extends PluginUserForm {

  public function configure()
  {
    $this->setWidget('password',  new sfWidgetFormInputPassword());
    $this->setWidget('repeat_password',  new sfWidgetFormInputPassword());

    $this->setValidators(array(
      'id' => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'username' => new sfValidatorString(array('required'=> true)),
      'email' => new sfValidatorEmail(array('required'=> true)),
      'password' => new sfValidatorString(array('required'=> true)),
      'organization' => new sfValidatorString(array('required'=> false)),
      'address' => new sfValidatorString(array('required'=> false)),
      'phone_number' => new sfValidatorString(array('required'=> false)),
      'city' => new sfValidatorString(array('required'=> false)),
      'is_active' => new sfValidatorString(array('required'=> false)),
     
    ));

    unset($this['id'],$this['is_super_admin'],$this['last_login'],$this['created_at'],$this['updated_at']);
/*
    $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(
      new sfValidatorSchemaCompare('password', '==', 'repeat_password'),
    )));*/
    $this->disableCSRFProtection();
    
    $this->useFields(array('organization', 'username', 'city', 'address', 'phone_number', 'email', 'password','is_active'));
  }
}

?>