Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- registerUserForm.class.php
- <?php
- class RegisterUserForm extends BaseRegisterUserForm {
- public function configure()
- {
- parent::configure();
- $this->widgetSchema['is_condition'] = new sfWidgetFormInputCheckbox();
- $this->setValidator('is_condition', new sfValidatorChoice(array('choices' => array('on'))));
- unset($this['salt']);
- $this->widgetSchema->setLabels(Array(
- 'username' => 'Nom d\'utilisateur',
- 'email' => 'E-mail',
- 'password' => 'Mot de passe',
- 'firstname' => 'Prénom',
- 'lastname' => 'Nom de famille',
- 'phone' => 'Téléphone',
- 'company' => 'Compagnie',
- 'companyType' => 'Objet de la compagnie',
- 'companyVat' => 'N° de TVA',
- 'companyAddress' => 'Adresse',
- 'companyCp' => 'Code Postal',
- 'companyCity' => 'Ville',
- 'companyCountry' => 'Pays',
- 'companyPhone' => 'Téléphone',
- 'companyUrl' => 'Site Web',
- 'companyFunction' => 'Fonction au sein de l\'entreprise',
- 'is_mailinglist' => 's\'abonner à la newsletter',
- 'repeat_password' => 'répéter le mot de passe',
- 'is_condition' => 'accepter les <a href=\'#\' id=\'condition\'>conditions d\'utilisation</a>'
- ));
- }
- }
- baseRegisterUserForm.class.php
- <?php
- class BaseRegisterUserForm 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)),
- 'repeat_password' => new sfValidatorString(array('required'=> true)),
- ));
- unset($this['id'],$this['is_active'],$this['is_super_admin'],$this['last_login'],$this['created_at'],$this['updated_at']);
- $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(
- new sfValidatorSchemaCompare('password', '==', 'repeat_password'),
- new sfValidatorDoctrineUnique(array('model'=> 'User','column'=> 'email')),
- new sfValidatorDoctrineUnique(array('model'=> 'User','column'=> 'username')),
- )));
- }
- }
- ?>
Add Comment
Please, Sign In to add comment