- Timestamp:
- 03/28/10 19:33:57 (3 years ago)
- Files:
-
- plugins/sfForkedDoctrineApplyPlugin/trunk/config/app.yml (added)
- plugins/sfForkedDoctrineApplyPlugin/trunk/config/doctrine/schema.yml (modified) (1 diff)
- plugins/sfForkedDoctrineApplyPlugin/trunk/i18n/pl/sfForkedApply.xml (added)
- plugins/sfForkedDoctrineApplyPlugin/trunk/lib/action/sfApplyActionsLibrary.class.php (modified) (4 diffs)
- plugins/sfForkedDoctrineApplyPlugin/trunk/lib/form/doctrine/PluginsfGuardUserProfileBasisForm.class.php (modified) (1 diff)
- plugins/sfForkedDoctrineApplyPlugin/trunk/lib/form/sfApplyApplyForm.class.php (modified) (2 diffs)
- plugins/sfForkedDoctrineApplyPlugin/trunk/lib/form/sfApplyResetRequestForm.class.php (modified) (1 diff)
- plugins/sfForkedDoctrineApplyPlugin/trunk/package.xml.tmpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfForkedDoctrineApplyPlugin/trunk/config/doctrine/schema.yml
r28651 r28839 18 18 #TODO! Should be used by task that will erase all validate fields created x days ago and not used. 19 19 validate_at: 20 type: datetime20 type: timestamp 21 21 validate: 22 22 type: string(33) plugins/sfForkedDoctrineApplyPlugin/trunk/lib/action/sfApplyActionsLibrary.class.php
r28770 r28839 17 17 if( $request->isMethod('post') ) 18 18 { 19 //Extracting parameters from sent sfApplyApply form 20 $this->form->bind($request->getParameter('sfApplyApply')); 19 //gathering form request in one array 20 $formValues = $request->getParameter('sfApplyApply'); 21 if(sfConfig::get('app_recaptcha_enabled') ) 22 { 23 $captcha = array( 24 'recaptcha_challenge_field' => $request->getParameter('recaptcha_challenge_field'), 25 'recaptcha_response_field' => $request->getParameter('recaptcha_response_field'), 26 ); 27 //Adding captcha to form array 28 $formValues = array_merge( $formValues, array('captcha' => $captcha) ); 29 } 30 //binding request form parameters with form 31 $this->form->bind($formValues); 21 32 if ($this->form->isValid()) 22 33 { … … 53 64 { 54 65 $this->redirect( 'sfApply/reset' ); 55 // $guardUser = $this->getUser()->getGuardUser();56 // $this->forward404Unless($guardUser);57 // return $this->resetRequestBody($guardUser);58 66 } 59 67 else … … 62 70 if ($request->isMethod('post')) 63 71 { 64 $this->form->bind($request->getParameter('sfApplyResetRequest')); 72 //gathering form request in one array 73 $formValues = $request->getParameter('sfApplyResetRequest'); 74 if(sfConfig::get('app_recaptcha_enabled') ) 75 { 76 $captcha = array( 77 'recaptcha_challenge_field' => $request->getParameter('recaptcha_challenge_field'), 78 'recaptcha_response_field' => $request->getParameter('recaptcha_response_field'), 79 ); 80 //Adding captcha to form array 81 $formValues = array_merge( $formValues, array('captcha' => $captcha) ); 82 } 83 //binding request form parameters with form 84 $this->form->bind($formValues); 65 85 if ($this->form->isValid()) 66 86 { … … 97 117 // Note that this only works if you set foreignAlias and 98 118 // foreignType correctly 99 $sfGuardUser = Doctrine_Query::create() ->100 from("sfGuardUser u")->101 innerJoin("u.Profile p with p.validate = ?", $validate)->102 fetchOne();119 $sfGuardUser = Doctrine_Query::create() 120 ->from("sfGuardUser u") 121 ->innerJoin("u.Profile p with p.validate = ?", $validate) 122 ->fetchOne(); 103 123 if (!$sfGuardUser) 104 124 { plugins/sfForkedDoctrineApplyPlugin/trunk/lib/form/doctrine/PluginsfGuardUserProfileBasisForm.class.php
r28651 r28839 11 11 abstract class PluginsfGuardUserProfileBasisForm extends BasesfGuardUserProfileBasisForm 12 12 { 13 public function setup() 14 { 15 parent::setup(); 16 sfProjectConfiguration::getActive()->loadHelpers(array('I18N')); 17 18 } 13 19 } plugins/sfForkedDoctrineApplyPlugin/trunk/lib/form/sfApplyApplyForm.class.php
r28651 r28839 113 113 } 114 114 115 //Include captcha if enabled 116 if ($this->isCaptchaEnabled() ) 117 { 118 $this->addCaptcha(); 119 } 120 115 121 $this->validatorSchema->setPostValidator( new sfValidatorAnd($postValidators) ); 116 122 } … … 144 150 } 145 151 152 public function isCaptchaEnabled() 153 { 154 return sfConfig::get('app_recaptcha_enabled'); 155 } 156 157 public function addCaptcha() 158 { 159 $this->widgetSchema['captcha'] = new sfWidgetFormReCaptcha(array( 160 'public_key' => sfConfig::get('app_recaptcha_public_key') 161 )); 162 163 $this->validatorSchema['captcha'] = new sfValidatorReCaptcha(array( 164 'private_key' => sfConfig::get('app_recaptcha_private_key') 165 )); 166 $this->validatorSchema['captcha'] 167 ->setMessage('captcha', __('The captcha is not valid (%error%).', array(), 'sfForkedApply')) 168 ->setMessage('server_problem', __('Unable to check the captcha from the server (%error%).', array(), 'sfForkedApply')); 169 } 170 146 171 147 172 function removeFields() plugins/sfForkedDoctrineApplyPlugin/trunk/lib/form/sfApplyResetRequestForm.class.php
r28651 r28839 4 4 class sfApplyResetRequestForm extends sfForm 5 5 { 6 public function configure() 7 { 8 parent::configure(); 6 public function configure() 7 { 8 parent::configure(); 9 sfProjectConfiguration::getActive()->loadHelpers(array('I18N')); 9 10 10 $this->setWidget('username_or_email',11 new sfWidgetFormInput( array(), array('maxlength' => 100)));11 $this->setWidget('username_or_email', 12 new sfWidgetFormInput( array(), array('maxlength' => 100))); 12 13 13 $this->setValidator('username_or_email',14 new sfValidatorOr( array(15 new sfValidatorAnd( array(16 new sfValidatorString( array(17 'required' => true,18 'trim' => true,19 'min_length' => 4,20 'max_length' => 16 ) ),21 new sfValidatorDoctrineChoice( array(22 'model' => 'sfGuardUser',23 'column' => 'username' ),24 array( "invalid" => "There is no such user.")))),25 new sfValidatorEmail(array('required' => true) ) )26 ));14 $this->setValidator('username_or_email', 15 new sfValidatorOr( array( 16 new sfValidatorAnd( array( 17 new sfValidatorString( array( 18 'required' => true, 19 'trim' => true, 20 'min_length' => 4, 21 'max_length' => 16 ) ), 22 new sfValidatorDoctrineChoice( array( 23 'model' => 'sfGuardUser', 24 'column' => 'username' ), 25 array( "invalid" => "There is no such user.")))), 26 new sfValidatorEmail(array('required' => true) ) ) 27 )); 27 28 28 $this->widgetSchema->setNameFormat('sfApplyResetRequest[%s]'); 29 $this->widgetSchema->setFormFormatterName('list'); 30 } 29 $this->widgetSchema->setNameFormat('sfApplyResetRequest[%s]'); 30 $this->widgetSchema->setFormFormatterName('list'); 31 32 //Include captcha if enabled 33 if ($this->isCaptchaEnabled() ) 34 { 35 $this->addCaptcha(); 36 } 37 } 38 39 public function isCaptchaEnabled() 40 { 41 return sfConfig::get('app_recaptcha_enabled'); 42 } 43 44 public function addCaptcha() 45 { 46 $this->widgetSchema['captcha'] = new sfWidgetFormReCaptcha(array( 47 'public_key' => sfConfig::get('app_recaptcha_public_key') 48 )); 49 50 $this->validatorSchema['captcha'] = new sfValidatorReCaptcha(array( 51 'private_key' => sfConfig::get('app_recaptcha_private_key') 52 )); 53 $this->validatorSchema['captcha'] 54 ->setMessage('captcha', __('The captcha is not valid (%error%).', array(), 'sfForkedApply')) 55 ->setMessage('server_problem', __('Unable to check the captcha from the server (%error%).', array(), 'sfForkedApply')); 56 } 31 57 } 32 58 plugins/sfForkedDoctrineApplyPlugin/trunk/package.xml.tmpl
r28819 r28839 52 52 <phprelease></phprelease> 53 53 <changelog> 54 <release> 55 <version> 56 <release>1.1.0</release> 57 <api>1.1.0</api> 58 </version> 59 <stability> 60 <release>stable</release> 61 <api>stable</api> 62 </stability> 63 <license uri="http://www.symfony-project.org/license">MIT license</license> 64 <date>2010-03-28</date> 65 <license>MIT</license> 66 <notes> 67 * fizyk: added recaptcha functionality to Apply and ResetRequests forms (based on vjCommentPlugin) 68 * fizyk: changed type of validate_at to timestamp from datetime. No change on generated sql (reported by Magician). 69 </notes> 70 </release> 54 71 <release> 55 72 <version>