Changeset 50
- Timestamp:
- 05/24/08 16:10:19
- Files:
-
- trunk/apps/main/config/routing.yml (modified) (1 diff)
- trunk/apps/main/modules/applications/templates/_filterForm.php (modified) (2 diffs)
- trunk/apps/main/modules/applications/templates/_form.php (modified) (2 diffs)
- trunk/apps/main/modules/applications/templates/connectAsCompanySuccess.php (modified) (2 diffs)
- trunk/apps/main/modules/applications/templates/connectAsDeveloperSuccess.php (modified) (2 diffs)
- trunk/apps/main/modules/sfGuardAuth/actions/actions.class.php (modified) (2 diffs)
- trunk/apps/main/modules/sfGuardAuth/templates/registerSuccess.php (modified) (5 diffs)
- trunk/lib/form/BaseFormPropel.class.php (modified) (2 diffs)
- trunk/lib/form/RegisterForm.class.php (added)
- trunk/lib/widget (added)
- trunk/lib/widget/sfValidatorEqual.class.php (added)
- trunk/plugins (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/apps/main/config/routing.yml
r46 r50 273 273 param: { module: sfGuardAuth, action: register } 274 274 275 user_register_done: 276 url: /register/done 277 param: { module sfGuardAuth, action: registerDone } 278 275 279 user_password_change: 276 280 url: /profile/password/change trunk/apps/main/modules/applications/templates/_filterForm.php
r2 r50 1 < ?php echo form_tag('@application_home', 'method=get id=country_form') ?>1 <form action="<?php echo url_for('@application_home') ?>" method="get" id="country_form"> 2 2 <p> 3 3 <?php echo label_for('country', __('Filter by country')) ?> … … 14 14 <?php echo submit_tag(__('Filter')) ?> 15 15 </p> 16 < ?php echo end_form() ?>16 </form> trunk/apps/main/modules/applications/templates/_form.php
r2 r50 10 10 </p> 11 11 12 < ?php echo form_tag($form_route, 'multipart=true') ?>12 <form action="<?php echo url_for($form_route) ?>" method="post" enctype="multipart/form-data"> 13 13 <div class="fiftypercent"> 14 14 <fieldset> … … 83 83 </p> 84 84 </div> 85 < ?php echo end_form() ?>85 </form> trunk/apps/main/modules/applications/templates/connectAsCompanySuccess.php
r2 r50 32 32 </p> 33 33 34 < ?php echo form_tag($sf_data->getRaw('form_action')) ?>34 <form action="<?php echo url_for($sf_data->getRaw('form_action')) ?>" method="post"> 35 35 <div class="fiftypercent"> 36 36 <fieldset> … … 80 80 </p> 81 81 </div> 82 < ?php echo end_form() ?>82 </form> trunk/apps/main/modules/applications/templates/connectAsDeveloperSuccess.php
r2 r50 36 36 </p> 37 37 38 < ?php echo form_tag($sf_data->getRaw('form_action')) ?>38 <form action="<?php echo url_for($sf_data->getRaw('form_action')) ?>" method="post"> 39 39 <div class="fiftypercent"> 40 40 <fieldset> … … 73 73 </p> 74 74 </div> 75 < ?php echo end_form() ?>75 </form> trunk/apps/main/modules/sfGuardAuth/actions/actions.class.php
r48 r50 222 222 } 223 223 224 public function executeRegister( )224 public function executeRegister(sfWebRequest $request) 225 225 { 226 226 if ($this->getUser()->isAuthenticated()) … … 229 229 } 230 230 231 if ($this->getRequest()->getMethod() !== sfRequest::POST) 232 { 231 $this->form = new RegisterForm(); 232 233 if (!$request->isMethod('post') or !$this->form->bindAndSave($request->getParameter('user'))) 234 { 235 return sfView::SUCCESS; // redisplay form with errors 236 } 237 238 // At this point we got a valid form and a created sfGuardUser object 239 $user = $this->form->getObject(); 240 241 // Create activation entry 242 $activation = new Activation(); 243 $activation->setUserId($user->getId()); 244 $activation->setHash(md5(rand(100000, 999999))); 245 $activation->save(); 246 247 // Send user an activation email 248 $this->getRequest()->setAttribute('user', $user); 249 $this->getRequest()->setAttribute('activation', $activation); 250 $mailSent = $this->sendSwiftSmtpPlainMail('mail', 'register', 251 $user->getEmail(), 252 $this->__('Please confirm your Symfonians account creation request')); 253 254 // If mail sending failed, 255 if (!$mailSent) 256 { 257 $this->getRequest()->setError('errors', $this->__('We were unable to send you an activation email. Registration process failed.')); 258 $activation->delete(); 259 $user->delete(); 233 260 return sfView::SUCCESS; 234 261 } 235 236 try 237 { 238 $user = new sfGuardUser(); 239 $user->setUsername($this->getRequestParameter('username')); 240 $user->setEmail($this->getRequestParameter('email')); 241 $user->setPassword($this->getRequestParameter('password')); 242 $user->setIsActive(false); 243 $user->save(); 244 245 $activation = new Activation(); 246 $activation->setUserId($user->getId()); 247 $activation->setHash(md5(rand(100000, 999999))); 248 $activation->save(); 249 250 $this->getRequest()->setAttribute('user', $user); 251 $this->getRequest()->setAttribute('activation', $activation); 252 253 $mailSent = $this->sendSwiftSmtpPlainMail('mail', 'register', 254 $user->getEmail(), 255 $this->__('Please confirm your Symfonians account creation request')); 256 257 if (!$mailSent) 258 { 259 $this->getRequest()->setError('errors', $this->__('We were unable to send you your activation email. Registration process failed.')); 260 $activation->delete(); 261 $user->delete(); 262 return sfView::SUCCESS; 263 } 264 $this->getUser()->setFlash('notice', sfContext::getInstance()->getI18N() 265 ->__('A confirmation mail has been sent to %mail%', 266 array('%mail%' => $user->getEmail()))); 267 $this->forward('sfGuardAuth', 'registerDone'); 268 } 269 catch (sfStopException $e) 270 { 271 return sfView::HEADER_ONLY; 272 } 273 catch (Exception $e) 274 { 275 $this->getRequest()->setError('errors', $this->__('Unable to register your account')); 276 sfContext::getInstance()->getLogger()->err('Blocking error at account registration time: '.$e->getMessage()); 277 return sfView::SUCCESS; 278 } 262 $this->getUser()->setFlash('notice', $this->__('A confirmation mail has been sent to %mail%', 263 array('%mail%' => $user->getEmail()))); 264 $this->redirect('@user_register_done'); 279 265 } 280 266 trunk/apps/main/modules/sfGuardAuth/templates/registerSuccess.php
r2 r50 27 27 </p> 28 28 29 < ?php echo form_tag('@user_register') ?>29 <form action="<?php echo url_for('@user_register') ?>" method="post"> 30 30 <div class="fiftypercent"> 31 31 <fieldset> 32 32 <legend><?php echo __('Account informations') ?></legend> 33 <?php echo $form ?> 34 <?php /* 33 35 <div class="form-row required"> 34 36 <label for="username"><?php echo __('Username') ?></label> … … 54 56 <?php echo form_error('password2') ?> 55 57 </div> 58 */?> 56 59 </fieldset> 57 60 </div> … … 60 63 <legend><?php echo __('Security') ?></legend> 61 64 <div class="form-row required"> 65 <?php /* 62 66 <?php echo label_for('captcha', __('Security code')) ?> 63 67 <?php echo input_tag('captcha', null, 'id=captcha style=width:100px'); ?> … … 68 72 <?php echo __('This codes aims at detecting if you are a bot or a human person.') ?> 69 73 </p> 74 */ ?> 70 75 </div> 71 76 </fieldset> … … 74 79 </p> 75 80 <p style="text-align:center"> 76 < ?php echo submit_tag(__('Click here to register your account')) ?>81 <input type="submit" value="<?php echo __('Click here to register your account') ?>" /> 77 82 </p> 78 83 </div> trunk/lib/form/BaseFormPropel.class.php
r48 r50 1 1 <?php 2 3 2 /** 4 3 * Project form base class. … … 11 10 public function setup() 12 11 { 12 sfWidgetFormSchema::setDefaultFormFormatterName('list'); 13 13 } 14 14 } trunk/plugins
- Property svn:externals changed from sfPropelAlternativeSchemaPlugin http://svn.symfony-project.com/plugins/sfPropelAlternativeSchemaPlugin sfWebBrowserPlugin http://svn.symfony-project.com/plugins/sfWebBrowserPlugin sfPagerNavigationPlugin http://svn.symfony-project.com/plugins/sfPagerNavigationPlugin sfFeed2Plugin http://svn.symfony-project.com/plugins/sfFeed2Plugin sfPropelMigrationsLightPlugin -r7087 http://svn.symfony-project.com/plugins/sfPropelMigrationsLightPlugin/trunk/ sfSwiftPlugin -r6447 http://svn.symfony-project.com/plugins/sfSwiftPlugin/trunk sfLucenePlugin http://svn.symfony-project.com/plugins/sfLucenePlugin/branches/1.1 sfGuardPlugin http://svn.symfony-project.com/plugins/sfGuardPlugin/branches/1.1 to sfPropelAlternativeSchemaPlugin http://svn.symfony-project.com/plugins/sfPropelAlternativeSchemaPlugin sfWebBrowserPlugin http://svn.symfony-project.com/plugins/sfWebBrowserPlugin sfPagerNavigationPlugin http://svn.symfony-project.com/plugins/sfPagerNavigationPlugin sfFeed2Plugin http://svn.symfony-project.com/plugins/sfFeed2Plugin sfPropelMigrationsLightPlugin -r7087 http://svn.symfony-project.com/plugins/sfPropelMigrationsLightPlugin/trunk/ sfSwiftPlugin -r6447 http://svn.symfony-project.com/plugins/sfSwiftPlugin/trunk sfLucenePlugin http://svn.symfony-project.com/plugins/sfLucenePlugin/branches/1.1 sfGuardPlugin http://svn.symfony-project.com/plugins/sfGuardPlugin/branches/1.1 sfFormExtraPlugin http://svn.symfony-project.com/plugins/sfFormExtraPlugin/
