Changeset 52
- Timestamp:
- 05/24/08 19:36:04
- Files:
-
- trunk/lib/form/BaseFormPropel.class.php (modified) (1 diff)
- trunk/lib/form/RegisterForm.class.php (modified) (3 diffs)
- trunk/lib/form/validator (added)
- trunk/lib/form/validator/sfValidatorBlacklist.class.php (added)
- trunk/lib/form/widget (added)
- trunk/lib/form/widget/sfWidgetFormSchemaFormatterDiv.class.php (added)
- trunk/web/css/style.css (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/form/BaseFormPropel.class.php
r50 r52 10 10 public function setup() 11 11 { 12 sfWidgetFormSchema::setDefaultFormFormatterName('list'); 12 sfWidgetFormSchema::setDefaultFormFormatterName('div'); 13 self::enableCSRFProtection('symf0n14n5'); 13 14 } 14 15 } trunk/lib/form/RegisterForm.class.php
r50 r52 3 3 * Member registration form 4 4 * 5 * @see sfGuardUserForm 5 6 */ 6 7 class RegisterForm extends BasesfGuardUserForm 7 8 { 9 10 static protected $forbidden_names = array('admin', 'niko', 'contact', 'info', 'infos', 'commercial', 'tech', 'support', 'sales', 'partnership', 'webmaster', 'business', 'owner'); 8 11 9 12 public function configure() 10 13 { 14 // widgets 11 15 $this->setWidgets(array( 12 16 'username' => new sfWidgetFormInput(), … … 16 20 )); 17 21 22 // helps 23 $this->widgetSchema->setHelps(array( 24 'username' => 'Your username should contains only alphanumeric, dash, dot or underscore characters, and begin with a letter.', 25 'email' => 'Please enter a valid email address. An activation link will be sent to this adress.', 26 'password' => 'Your password must be 6 characters length minimum.', 27 'password2' => 'Please confirm your password for avoiding typos.' 28 )); 29 30 // validators 18 31 $this->setValidators(array( 19 'username' => new sfValidatorString(array('min_length' => 3, 'max_length' => 20)), 32 'username' => new sfValidatorAnd(array( 33 new sfValidatorString(array('min_length' => 3, 'max_length' => 20)), 34 new sfValidatorRegex(array('pattern' => '/^[a-zA-Z]([a-zA-Z0-9._-]+)$/'), array('invalid' => 'Name "%value%" contains forbidden characters')), 35 new sfValidatorBlacklist(array('choices' => self::$forbidden_names), array('invalid' => 'Name "%value%" is blacklisted')), 36 )), 20 37 'email' => new sfValidatorAnd(array( 21 38 new sfValidatorString(array('max_length' => 100)), … … 26 43 )); 27 44 45 // post validator 28 46 $this->validatorSchema->setPostValidator(new sfValidatorAnd(array( 29 47 new sfValidatorSchemaCompare('password', 'equal', 'password2', array('throw_global_error' => true)), trunk/web/css/style.css
r2 r52 725 725 padding-left: 12px; 726 726 } 727 728 .form_error { 729 color: red; 730 font-size: .8em; 731 } 727 728 .form-row.field_error input, 729 .form-row.field_error select, 730 .form-row.field_error textarea { 731 color: red; 732 } 733 734 ul.error_list { 735 margin: 0; 736 padding: 0; 737 } 738 739 ul.error_list li { 740 margin: 0; 741 padding: 0; 742 color: red; 743 font-size: .8em; 744 } 732 745 733 746 .form_help { … … 737 750 738 751 .form-errors { 739 background: #d00 url(/sf/sf_default/images/icons/cancel48.png) no-repeat 740 2px 4px; 752 background: #d00 url(/sf/sf_default/images/icons/cancel48.png) no-repeat 2px 4px; 741 753 color: #fff; 742 754 padding: .5em .5em .5em 55px;
