Guest User

Untitled

a guest
Aug 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. registerUserForm.class.php
  2.  
  3. <?php
  4.  
  5. class RegisterUserForm extends BaseRegisterUserForm {
  6.  
  7. public function configure()
  8. {
  9. parent::configure();
  10.  
  11. $this->widgetSchema['is_condition'] = new sfWidgetFormInputCheckbox();
  12. $this->setValidator('is_condition', new sfValidatorChoice(array('choices' => array('on'))));
  13. unset($this['salt']);
  14.  
  15. $this->widgetSchema->setLabels(Array(
  16. 'username' => 'Nom d\'utilisateur',
  17. 'email' => 'E-mail',
  18. 'password' => 'Mot de passe',
  19. 'firstname' => 'Prénom',
  20. 'lastname' => 'Nom de famille',
  21. 'phone' => 'Téléphone',
  22. 'company' => 'Compagnie',
  23. 'companyType' => 'Objet de la compagnie',
  24. 'companyVat' => 'N° de TVA',
  25. 'companyAddress' => 'Adresse',
  26. 'companyCp' => 'Code Postal',
  27. 'companyCity' => 'Ville',
  28. 'companyCountry' => 'Pays',
  29. 'companyPhone' => 'Téléphone',
  30. 'companyUrl' => 'Site Web',
  31. 'companyFunction' => 'Fonction au sein de l\'entreprise',
  32. 'is_mailinglist' => 's\'abonner à la newsletter',
  33. 'repeat_password' => 'répéter le mot de passe',
  34. 'is_condition' => 'accepter les <a href=\'#\' id=\'condition\'>conditions d\'utilisation</a>'
  35. ));
  36. }
  37. }
  38.  
  39. baseRegisterUserForm.class.php
  40.  
  41. <?php
  42.  
  43. class BaseRegisterUserForm extends PluginUserForm {
  44.  
  45. public function configure()
  46. {
  47. $this->setWidget('password', new sfWidgetFormInputPassword());
  48. $this->setWidget('repeat_password', new sfWidgetFormInputPassword());
  49.  
  50. $this->setValidators(array(
  51. 'id' => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
  52. 'username' => new sfValidatorString(array('required'=> true)),
  53. 'email' => new sfValidatorEmail(array('required'=> true)),
  54. 'password' => new sfValidatorString(array('required'=> true)),
  55. 'repeat_password' => new sfValidatorString(array('required'=> true)),
  56. ));
  57.  
  58. unset($this['id'],$this['is_active'],$this['is_super_admin'],$this['last_login'],$this['created_at'],$this['updated_at']);
  59.  
  60. $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(
  61. new sfValidatorSchemaCompare('password', '==', 'repeat_password'),
  62. new sfValidatorDoctrineUnique(array('model'=> 'User','column'=> 'email')),
  63. new sfValidatorDoctrineUnique(array('model'=> 'User','column'=> 'username')),
  64. )));
  65. }
  66. }
  67.  
  68. ?>
Add Comment
Please, Sign In to add comment