Changeset 10620
- Timestamp:
- Feb 4, 2009, 1:26:04 PM (14 years ago)
- Location:
- OpenPNE3/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
OpenPNE3/trunk/apps/mobile_frontend/i18n/messages.ja.xml
r10545 r10620 291 291 <target>前のページに戻る</target> 292 292 </trans-unit> 293 </body> 293 <trans-unit id=""> 294 <source>Please input by a-z or A-Z or 6-12 characters and 6-12 length.</source> 295 <target>6~12文字の半角英数で入力してください。</target> 296 </trans-unit> 297 </body> 294 298 </file> 295 299 </xliff> -
OpenPNE3/trunk/apps/pc_frontend/i18n/messages.ja.xml
r10582 r10620 467 467 <target>これ以上画像を追加できません。</target> 468 468 </trans-unit> 469 </body> 469 <trans-unit id=""> 470 <source>Please input by a-z or A-Z or 6-12 characters and 6-12 length.</source> 471 <target>6~12文字の半角英数で入力してください。</target> 472 </trans-unit> 473 </body> 470 474 </file> 471 475 </xliff> -
OpenPNE3/trunk/lib/form/MemberConfigForm.class.php
r10545 r10620 87 87 $this->widgetSchema->setLabel($name.'_confirm', $config['Caption'].' (Confirm)'); 88 88 89 $this->mergePostValidator(new sfValidatorSchemaCompare($name , '==', $name.'_confirm'));89 $this->mergePostValidator(new sfValidatorSchemaCompare($name.'_confirm', '==', $name)); 90 90 } 91 91 -
OpenPNE3/trunk/lib/form/MemberConfigForm/MemberConfigPasswordForm.class.php
r10455 r10620 23 23 { 24 24 $this->setWidget('now_password', new sfWidgetFormInputPassword()); 25 $this->setValidator('now_password', new sfValidatorCallback(array('callback' => array($this, 'isValidPassword')))); 25 $this->setValidator( 26 'now_password', 27 new sfValidatorCallback( 28 array('callback' => array($this, 'isValidNowPassword'), 'required' => true) 29 ) 30 ); 26 31 $this->widgetSchema->setLabel('now_password', 'Your current password'); 32 } 33 34 public function setMemberConfigWidget($name) 35 { 36 $result = parent::setMemberConfigWidget($name); 37 38 if ($name === 'password') 39 { 40 $this->setValidator( $name, new sfValidatorCallback(array( 41 'callback' => array($this, 'isValidPassword'), 42 'required' => true 43 ))); 44 } 45 46 return $result; 47 } 48 49 public function isValidNowPassword($validator, $value) 50 { 51 $member = sfContext::getInstance()->getUser()->getMember(); 52 if (md5($value) !== MemberConfigPeer::retrieveByNameAndMemberId('password', $member->getId())->getValue()) 53 { 54 throw new sfValidatorError(new sfValidatorPass(), 'Invalid.', array('value' => $value)); 55 } 56 57 return $value; 27 58 } 28 59 29 60 public function isValidPassword($validator, $value) 30 61 { 31 $ member = sfContext::getInstance()->getUser()->getMember();32 if ( md5($value) !== MemberConfigPeer::retrieveByNameAndMemberId('password', $member->getId())->getValue())62 $size = strlen($value); 63 if (!preg_match("/^[a-zA-Z0-9]+$/", $value) || $size < 6 || $size > 12) 33 64 { 34 throw new sfValidatorError(new sfValidatorPass(), ' invalid', array('value' => $value));65 throw new sfValidatorError(new sfValidatorPass(), 'Please input by a-z or A-Z or 6-12 characters and 6-12 length.', array('value' => $value)); 35 66 } 36 67 37 68 return $value; 38 69 } 70 71 public function save() 72 { 73 $this->values['password'] = md5($this->values['password']); 74 parent::save(); 75 } 39 76 }
Note: See TracChangeset
for help on using the changeset viewer.