Changeset 53
- Timestamp:
- 05/25/08 15:30:16 (2 years ago)
- Files:
-
- trunk/apps/main/modules/sfGuardAuth/actions/actions.class.php (modified) (22 diffs)
- trunk/apps/main/modules/sfGuardAuth/lib/BasesfGuardAuthActions.class.php (modified) (3 diffs)
- trunk/apps/main/modules/sfGuardAuth/templates/registerSuccess.php (modified) (3 diffs)
- trunk/apps/main/modules/sfGuardAuth/templates/resendActivationSuccess.php (modified) (2 diffs)
- trunk/apps/main/modules/sfGuardAuth/templates/signinSuccess.php (modified) (1 diff)
- trunk/apps/main/modules/sfGuardAuth/validate/register.yml (deleted)
- trunk/lib/form/user (added)
- trunk/lib/form/user/ActivationForm.class.php (moved) (moved from trunk/lib/form/ActivationForm.class.php)
- trunk/lib/form/user/RegisterForm.class.php (moved) (moved from trunk/lib/form/RegisterForm.class.php) (5 diffs)
- trunk/lib/form/validator (deleted)
- trunk/lib/form/widget (deleted)
- trunk/lib/model/PluginsfGuardUser.php (modified) (5 diffs)
- trunk/lib/validator (added)
- trunk/lib/validator/sfValidatorBlacklist.class.php (copied) (copied from trunk/lib/form/validator/sfValidatorBlacklist.class.php)
- trunk/lib/widget (added)
- trunk/lib/widget/sfWidgetFormSchemaFormatterDiv.class.php (copied) (copied from trunk/lib/form/widget/sfWidgetFormSchemaFormatterDiv.class.php)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/apps/main/modules/sfGuardAuth/actions/actions.class.php
r50 r53 10 10 { 11 11 12 public function executeActivate( )12 public function executeActivate(sfWebRequest $request) 13 13 { 14 14 /* … … 31 31 catch (Exception $e) 32 32 { 33 $ this->getRequest()->setError('errors', $this->__('Unable to activate your account'));33 $request->setError('errors', $this->__('Unable to activate your account')); 34 34 sfContext::getInstance()->getLogger()->err('Blocking error at account activation time: '.$e->getMessage()); 35 35 return sfView::SUCCESS; … … 37 37 } 38 38 39 public function executeChangePassword( )40 { 41 if ($ this->getRequest()->getMethod() == sfRequest::POST)39 public function executeChangePassword(sfWebRequest $request) 40 { 41 if ($request->isMethod('post')) 42 42 { 43 43 $user = $this->getUser()->getGuardUser(); 44 $password = $ this->getRequestParameter('new_password');44 $password = $request->getParameter('new_password'); 45 45 $user->setPassword($password); 46 46 $user->save(); … … 50 50 } 51 51 52 public function executeDeleteAvatar( )52 public function executeDeleteAvatar(sfWebRequest $request) 53 53 { 54 54 $user = $this->getUser()->getGuardUser(); … … 72 72 } 73 73 74 public function executeForgotPassword( )75 { 76 if ($ this->getRequest()->getMethod() == sfRequest::POST)74 public function executeForgotPassword(sfWebRequest $request) 75 { 76 if ($request->isMethod('post')) 77 77 { 78 78 $password = substr(md5(rand(100000, 999999)), 0, 8); 79 $email = $ this->getRequestParameter('email');79 $email = $request->getParameter('email'); 80 80 $user = sfGuardUserPeer::retrieveByEmail($email); 81 81 $this->forward404Unless($user, sprintf('User not with email "%s" found', $email)); … … 83 83 $user->save(); 84 84 85 $ this->getRequest()->setAttribute('user', $user);86 $ this->getRequest()->setAttribute('password', $password);85 $request->setAttribute('user', $user); 86 $request->setAttribute('password', $password); 87 87 $mailSent = $this->sendSwiftSmtpPlainMail('mail', 'forgotPassword', 88 88 $user->getEmail(), … … 90 90 if (!$mailSent) 91 91 { 92 $ this->getRequest()->setError('errors', $this->__('We were not able to send you an email. Please try again later.'));92 $request->setError('errors', $this->__('We were not able to send you an email. Please try again later.')); 93 93 return sfView::SUCCESS; 94 94 } … … 99 99 } 100 100 101 public function executeProfile( )101 public function executeProfile(sfWebRequest $request) 102 102 { 103 103 $this->embedGoogleJavascriptApi(); … … 105 105 $this->user = $this->getUser()->getGuardUser(); 106 106 107 if ($ this->getRequest()->getMethod() != sfRequest::POST)107 if ($request->getMethod() != sfRequest::POST) 108 108 { 109 109 return sfView::SUCCESS; 110 110 } 111 111 112 $profile = $ this->getRequestParameter('profile', array());112 $profile = $request->getParameter('profile', array()); 113 113 114 114 # 1. Boolean values … … 177 177 catch (Exception $e) 178 178 { 179 $ this->getRequest()->setError('errors', $this->__('Unable to save your profile'));179 $request->setError('errors', $this->__('Unable to save your profile')); 180 180 sfContext::getInstance()->getLogger()->err('Blocking error at profile save time: '.$e->getMessage()); 181 181 return sfView::SUCCESS; … … 183 183 } 184 184 185 public function executeSkills( )185 public function executeSkills(sfWebRequest $request) 186 186 { 187 187 $this->user = $this->getUser()->getGuardUser(); … … 189 189 $this->skill_tags = sfConfig::get('app_people_skill_tags', array()); 190 190 asort($this->skill_tags); 191 if ($ this->getRequest()->getMethod() == sfRequest::POST)192 { 193 $user_skills = $ this->getRequestParameter('skills', array());191 if ($request->isMethod('post')) 192 { 193 $user_skills = $request->getParameter('skills', array()); 194 194 $this->user->removeAllTags(); 195 195 $this->user->save(); … … 231 231 $this->form = new RegisterForm(); 232 232 233 if (!$request->isMethod('post') or !$this->form->bindAndSave($request->getParameter('user'))) 233 // Recaptcha parameters 234 $captcha = array( 235 'recaptcha_challenge_field' => $request->getParameter('recaptcha_challenge_field'), 236 'recaptcha_response_field' => $request->getParameter('recaptcha_response_field'), 237 ); 238 $params = array_merge($request->getParameter('user', array()), array('captcha' => $captcha)); 239 240 if (!$request->isMethod('post') or !$this->form->bindAndSave($params)) 234 241 { 235 242 return sfView::SUCCESS; // redisplay form with errors … … 246 253 247 254 // Send user an activation email 248 $ this->getRequest()->setAttribute('user', $user);249 $ this->getRequest()->setAttribute('activation', $activation);255 $request->setAttribute('user', $user); 256 $request->setAttribute('activation', $activation); 250 257 $mailSent = $this->sendSwiftSmtpPlainMail('mail', 'register', 251 258 $user->getEmail(), … … 255 262 if (!$mailSent) 256 263 { 257 $ this->getRequest()->setError('errors', $this->__('We were unable to send you an activation email. Registration process failed.'));264 $request->setError('errors', $this->__('We were unable to send you an activation email. Registration process failed.')); 258 265 $activation->delete(); 259 266 $user->delete(); … … 265 272 } 266 273 267 public function executeRegisterDone( )268 { 269 $this->user = $ this->getRequest()->getAttribute('user');270 return sfView::SUCCESS; 271 } 272 273 public function executeResendActivation( )274 { 275 if ($ this->getRequest()->getMethod() == sfRequest::POST)276 { 277 $email = $ this->getRequestParameter('email');274 public function executeRegisterDone(sfWebRequest $request) 275 { 276 $this->user = $request->getAttribute('user'); 277 return sfView::SUCCESS; 278 } 279 280 public function executeResendActivation(sfWebRequest $request) 281 { 282 if ($request->isMethod('post')) 283 { 284 $email = $request->getParameter('email'); 278 285 $user = sfGuardUserPeer::retrieveByEmail($email); 279 286 … … 281 288 $c->add(ActivationPeer::USER_ID, $user->getId()); 282 289 $activation = ActivationPeer::doSelectOne($c); 283 $ this->getRequest()->setAttribute('activation', $activation);290 $request->setAttribute('activation', $activation); 284 291 285 292 $mailSent = $this->sendSwiftSmtpPlainMail('mail', 'resendActivation', … … 288 295 if (!$mailSent) 289 296 { 290 $ this->getRequest()->setError('errors', $this->__('We were unable to send you an email. We are digging the problem, stay tuned.'));297 $request->setError('errors', $this->__('We were unable to send you an email. We are digging the problem, stay tuned.')); 291 298 return sfView::SUCCESS; 292 299 } … … 321 328 if (!$this->activation) 322 329 { 323 $ this->getRequest()->setError('errors', $this->__('Unable to find this activation key: '.$key));330 $request->setError('errors', $this->__('Unable to find this activation key: '.$key)); 324 331 return false; 325 332 } … … 343 350 public function validateChangePassword() 344 351 { 345 if ($this->getRequest()-> getMethod() == sfRequest::POST)352 if ($this->getRequest()->isMethod('post')) 346 353 { 347 354 $user = $this->getUser()->getGuardUser(); 348 355 if (!$user->checkPassword($this->getRequestParameter('current_password'))) 349 356 { 350 $ this->getRequest()->setError('errors', $this->__('You did not provide your current password correctly!'));357 $request->setError('errors', $this->__('You did not provide your current password correctly!')); 351 358 return false; 352 359 } … … 357 364 public function validateForgotPassword() 358 365 { 359 if ($this->getRequest()-> getMethod() == sfRequest::POST)366 if ($this->getRequest()->isMethod('post')) 360 367 { 361 368 $user = sfGuardUserPeer::retrieveByEmail(trim($this->getRequestParameter('email'))); … … 376 383 public function validateResendActivation() 377 384 { 378 if ($this->getRequest()-> getMethod() == sfRequest::POST)385 if ($this->getRequest()->isMethod('post')) 379 386 { 380 387 $user = sfGuardUserPeer::retrieveByEmail(trim($this->getRequestParameter('email'))); trunk/apps/main/modules/sfGuardAuth/lib/BasesfGuardAuthActions.class.php
r48 r53 1 1 <?php 2 3 /*4 * This file is part of the symfony package.5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>6 *7 * For the full copyright and license information, please view the LICENSE8 * file that was distributed with this source code.9 */10 11 2 /** 12 * 3 * Base sfGuardAuth actions 4 * 13 5 * @package symfony 14 6 * @subpackage plugin 15 * @author Fabien Potencier <fabien.potencier@symfony-project.com>16 * @version SVN: $Id: BasesfGuardAuthActions.class.php 6352 2007-12-07 09:16:20Z fabien $17 7 */ 18 8 class BasesfGuardAuthActions extends myActions 19 9 { 20 public function executeSignin( )10 public function executeSignin(sfWebRequest $request) 21 11 { 22 12 $user = $this->getUser(); 23 if ($ this->getRequest()->getMethod() == sfRequest::POST)13 if ($user->isAuthenticated()) 24 14 { 25 $redirect = $user->getAttribute('redirect_after_login'); 26 $user->getAttributeHolder()->remove('redirect_after_login'); 15 return $this->redirect('@homepage'); 16 } 17 18 $this->form = new SigninForm(); 19 20 if ($request->isMethod('post')) 21 { 22 $this->form->bind($request->getParameter('signin')); 27 23 28 if ( !$redirect) // Trying referer24 if ($this->form->isValid()) 29 25 { 30 $redirect = $user->getAttribute('referer', $this->getRequest()->getReferer()); 31 $user->getAttributeHolder()->remove('referer'); 26 $values = $this->form->getValues(); 27 $this->getUser()->signin($values['user'], 'on' === $values['remember']); 28 29 $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $user->getReferer($request->getReferer())); 30 31 return $this->redirect('' != $signinUrl ? $signinUrl : '@homepage'); 32 32 } 33 34 if (!$redirect) // Getting default redirect route35 {36 $redirect = sfConfig::get('app_sf_guard_plugin_success_signin_url', '@homepage');37 }38 39 $this->logMessage('Redirecting to '.$redirect);40 $this->redirect($redirect);41 }42 elseif ($user->isAuthenticated())43 {44 $redirect = $user->getAttribute('redirect', '@homepage');45 $user->getAttributeHolder()->remove('redirect');46 $this->redirect($redirect);47 33 } 48 34 else 49 35 { 50 if ($ this->getRequest()->isXmlHttpRequest())36 if ($request->isXmlHttpRequest()) 51 37 { 52 38 $this->getResponse()->setHeaderOnly(true); … … 56 42 } 57 43 58 if (!$user->hasAttribute('referer')) 59 { 60 $user->setAttribute('referer', $this->getRequest()->getReferer()); 61 } 44 $user->setReferer($request->getReferer()); 62 45 63 if ($this->getModuleName() != ($module = sfConfig::get('sf_login_module'))) 46 $module = sfConfig::get('sf_login_module'); 47 if ($this->getModuleName() != $module) 64 48 { 65 49 return $this->redirect($module.'/'.sfConfig::get('sf_login_action')); 66 50 } 67 68 $routing = sfContext::getInstance()->getRouting(); 69 try 70 { 71 $controller = sfContext::getInstance()->getController(); 72 $uri = sfContext::getInstance()->getRouting()->getCurrentInternalUri(true); 73 $redirect = $controller->genUrl($uri, true); 74 $user->setAttribute('redirect_after_login', $redirect); 75 $this->logMessage(sprintf('Redirect url set to %s', $redirect)); 76 } 77 catch (Exception $e) 78 { 79 $this->logMessage('Unable to generate url for current route: '.$e->getMessage(), 80 'warning'); 81 } 82 51 83 52 $this->getResponse()->setStatusCode(401); 84 53 } 85 54 } 86 55 87 public function executeSignout( )56 public function executeSignout(sfWebRequest $request) 88 57 { 89 58 $this->getUser()->signOut(); 90 $signout_url = sfConfig::get('app_sf_guard_plugin_success_signout_url', '@homepage'); 91 $this->redirect($signout_url); 59 60 $signout_url = sfConfig::get('app_sf_guard_plugin_success_signout_url', $request->getReferer()); 61 62 $this->redirect('' != $signout_url ? $signout_url : '@homepage'); 92 63 } 93 64 94 65 public function executeSecure() 95 66 { 96 $this->getUser()->setAttribute('redirect_after_login',97 sfContext::getInstance()->getRouting()->getCurrentInternalUri(true));98 67 $this->getResponse()->setStatusCode(403); 99 68 } … … 103 72 throw new sfException('This method is not yet implemented.'); 104 73 } 105 106 public function handleErrorSignin()107 {108 $user = $this->getUser();109 if (!$user->hasAttribute('referer'))110 {111 $user->setAttribute('referer', $this->getRequest()->getReferer());112 }113 114 $module = sfConfig::get('sf_login_module');115 if ($this->getModuleName() != $module)116 {117 $this->forward(sfConfig::get('sf_login_module'), sfConfig::get('sf_login_action'));118 }119 120 return sfView::SUCCESS;121 }122 74 } trunk/apps/main/modules/sfGuardAuth/templates/registerSuccess.php
r50 r53 31 31 <fieldset> 32 32 <legend><?php echo __('Account informations') ?></legend> 33 <?php echo $form ?> 34 <?php /* 35 <div class="form-row required"> 36 <label for="username"><?php echo __('Username') ?></label> 37 <?php echo input_tag('username', $sf_params->get('username')) ?> 38 <div class="form_help"><?php echo __('Only alphanumeric, dash, underscore and dot characters allowed.') ?></div> 39 <?php echo form_error('username') ?> 40 </div> 41 <div class="form-row required"> 42 <label for="email"><?php echo __('Email') ?></label> 43 <?php echo input_tag('email', $sf_params->get('email')) ?> 44 <div class="form_help"><?php echo __('A valid mail address is required. An activation message will be sent.') ?></div> 45 <?php echo form_error('email') ?> 46 </div> 47 <div class="form-row required"> 48 <label for="password"><?php echo __('Password') ?></label> 49 <?php echo input_password_tag('password') ?> 50 <div class="form_help"><?php echo __('Six characters minimum.') ?></div> 51 <?php echo form_error('password') ?> 52 </div> 53 <div class="form-row required"> 54 <label for="password2"><?php echo __('Confirm password') ?></label> 55 <?php echo input_password_tag('password2') ?> 56 <?php echo form_error('password2') ?> 57 </div> 58 */?> 33 <?php echo $form->renderGlobalErrors() ?> 34 <?php echo $form['username']->renderRow() ?> 35 <?php echo $form['email']->renderRow() ?> 36 <?php echo $form['password']->renderRow() ?> 37 <?php echo $form['password2']->renderRow() ?> 59 38 </fieldset> 60 39 </div> … … 62 41 <fieldset> 63 42 <legend><?php echo __('Security') ?></legend> 64 <div class="form-row required"> 65 <?php /* 66 <?php echo label_for('captcha', __('Security code')) ?> 67 <?php echo input_tag('captcha', null, 'id=captcha style=width:100px'); ?> 68 <?php echo cryptographp_picture() ?> 69 <?php echo cryptographp_reload() ?> 70 <?php echo form_error('captcha') ?> 71 <p class="form-help"> 72 <?php echo __('This codes aims at detecting if you are a bot or a human person.') ?> 73 </p> 74 */ ?> 75 </div> 43 <?php echo $form['captcha']->renderRow() ?> 76 44 </fieldset> 77 45 <p class="tip"> … … 79 47 </p> 80 48 <p style="text-align:center"> 49 <?php echo $form['_csrf_token'] ?> 81 50 <input type="submit" value="<?php echo __('Click here to register your account') ?>" /> 82 51 </p> trunk/apps/main/modules/sfGuardAuth/templates/resendActivationSuccess.php
r2 r53 18 18 </p> 19 19 20 < ?php echo form_tag('@user_resend_activation') ?>20 <form action="<?php echo url_for('@user_resend_activation') ?>" method="post"> 21 21 <div class="fiftypercent"> 22 22 <fieldset> 23 23 <legend><?php echo __('Account informations') ?></legend> 24 <?php echo $form->renderGlobalErrors() ?> 25 <?php echo $form['email']->renderRow() ?> 26 <?php /* 24 27 <div class="form-row required"> 25 28 <label for="email"><?php echo __('Email address you provided at registration time') ?></label> … … 37 40 </p> 38 41 </div> 42 */ ?> 39 43 <p> 40 <?php echo submit_tag(__('Send me my activation mail')) ?> 44 <?php echo $form['_csrf_token'] ?> 45 <input type="submit" value="<?php echo __('Send me my activation mail') ?>" /> 41 46 </p> 42 47 </fieldset> trunk/apps/main/modules/sfGuardAuth/templates/signinSuccess.php
r2 r53 11 11 12 12 <div id="sf_guard_auth_form"> 13 <?php echo form_tag('@sf_guard_signin') ?> 14 <div class="fiftypercent"> 15 <fieldset> 16 <legend><?php echo __('Please sign in') ?></legend> 17 <div class="form-row"> 18 <?php 19 echo form_error('username'), 20 label_for('username', __('Username')), 21 input_tag('username', $sf_data->get('sf_params')->get('username')); 22 ?> 23 </div> 24 <div class="form-row"> 25 <?php 26 echo form_error('password'), 27 label_for('password', __('Password')), 28 input_password_tag('password'); 29 ?> 30 </div> 31 <div class="form-row"> 32 <?php echo checkbox_tag('remember') ?> 33 <?php echo label_for('remember', __('Remember me?'), 'class=inline') ?> 34 </div> 35 <div class="form-row"> 36 <?php echo submit_tag(__('sign in')) ?> 37 | 38 <?php echo link_to(__('Forgot your password?'), 39 '@user_forgot_password', 40 array('id' => 'forgot_password')) ?> 41 </div> 42 </fieldset> 43 </div> 44 <div class="fiftypercent"> 45 <fieldset> 46 <legend><?php echo __('You don\'t have an account yet ?') ?></legend> 47 <div class="form-row"> 48 <?php echo big_button_to(__('Sign up!'), '@user_register', 'id=bt_signup') ?> 49 </div> 50 <p style="text-align:center"> 51 <?php echo link_to(__('Never received activation mail?'), 52 '@user_resend_activation', 53 array('id' => 'resend_activation')) ?> 54 </p> 55 </fieldset> 56 </div> 57 <?php echo end_form() ?> 13 <form action="<?php echo url_for('@sf_guard_signin') ?>" method="post"> 14 <div class="fiftypercent"> 15 <fieldset> 16 <legend><?php echo __('Please sign in') ?></legend> 17 <?php echo $form->renderGlobalErrors() ?> 18 <?php echo $form['username']->renderRow() ?> 19 <?php echo $form['password']->renderRow() ?> 20 <p> 21 <?php echo $form['remember'] ?> 22 <?php echo $form['remember']->renderLabel(__('Remember me'), array('class' => 'inline')) ?> 23 </p> 24 <div class="form-row"> 25 <?php echo $form['_csrf_token'] ?> 26 <input type="submit" value="<?php echo __('sign in') ?>" /> 27 | 28 <?php echo link_to(__('Forgot your password?'), 29 '@user_forgot_password', 30 array('id' => 'forgot_password')) ?> 31 </div> 32 </fieldset> 33 </div> 34 <div class="fiftypercent"> 35 <fieldset> 36 <legend><?php echo __('You don\'t have an account yet ?') ?></legend> 37 <div class="form-row"> 38 <?php echo big_button_to(__('Sign up!'), '@user_register', 'id=bt_signup') ?> 39 </div> 40 <p style="text-align:center"> 41 <?php echo link_to(__('Never received activation mail?'), 42 '@user_resend_activation', 43 array('id' => 'resend_activation')) ?> 44 </p> 45 </fieldset> 46 </div> 47 </form> 58 48 </div> trunk/lib/form/user/RegisterForm.class.php
r52 r53 8 8 { 9 9 10 static protected $forbidden_names = array('admin', 'niko', 'contact', 'info', 'infos', 'commercial', 'tech', 'support', 'sales', 'partnership', 'webmaster', 'business', 'owner'); 10 static protected 11 $forbidden_names = array('admin', 'niko', 'contact', 'info', 'infos', 'commercial', 'tech', 'support', 'sales', 'partnership', 'webmaster', 'business', 'owner'); 11 12 12 13 public function configure() … … 18 19 'password' => new sfWidgetFormInputPassword(), 19 20 'password2' => new sfWidgetFormInputPassword(), 21 'captcha' => new sfWidgetFormReCaptcha(array('public_key' => sfConfig::get('app_recaptcha_public_key'))), 20 22 )); 21 23 … … 25 27 'email' => 'Please enter a valid email address. An activation link will be sent to this adress.', 26 28 'password' => 'Your password must be 6 characters length minimum.', 27 'password2' => 'Please confirm your password for avoiding typos.' 29 'password2' => 'Please confirm your password for avoiding typos.', 30 'captcha' => 'This codes aims at detecting if you are a bot or a human person.', 28 31 )); 29 32 … … 41 44 'password' => new sfValidatorString(array('min_length' => 6, 'max_length' => 128)), 42 45 'password2' => new sfValidatorString(array('min_length' => 6, 'max_length' => 128)), 46 'captcha' => new sfValidatorReCaptcha(array('private_key' => sfConfig::get('app_recaptcha_private_key'))), 43 47 )); 44 48 … … 46 50 $this->validatorSchema->setPostValidator(new sfValidatorAnd(array( 47 51 new sfValidatorSchemaCompare('password', 'equal', 'password2', array('throw_global_error' => true)), 48 new sfValidatorPropelUnique(array('model' => 'sfGuardUser', 49 'column' => 'username')),52 new sfValidatorPropelUnique(array('model' => 'sfGuardUser', 'column' => 'username')), 53 new sfValidatorPropelUnique(array('model' => 'sfGuardUser', 'column' => 'email')) 50 54 ))); 51 55 trunk/lib/model/PluginsfGuardUser.php
r49 r53 1 1 <?php 2 3 /* 4 * This file is part of the symfony package. 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 2 11 /** 3 * Local representation of sfGuardUser4 12 * 5 13 * @package symfony 6 14 * @subpackage plugin 15 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 16 * @version SVN: $Id: PluginsfGuardUser.php 7995 2008-03-20 06:58:43Z fabien $ 7 17 */ 8 18 class PluginsfGuardUser extends BasesfGuardUser … … 12 22 $groups = null, 13 23 $permissions = null, 14 $allPermissions = null, 15 $justKarma = false; 24 $allPermissions = null; 16 25 17 26 /** … … 358 367 { 359 368 } 369 370 public function setPasswordHash($v) 371 { 372 if (!is_null($v) && !is_string($v)) 373 { 374 $v = (string) $v; 375 } 376 377 if ($this->password !== $v) 378 { 379 $this->password = $v; 380 $this->modifiedColumns[] = sfGuardUserPeer::PASSWORD; 381 } 382 } 360 383 361 384 /** … … 386 409 { 387 410 $algorithm = $this->getAlgorithm(); 411 388 412 if (false !== $pos = strpos($algorithm, '::')) 389 413 { 390 414 $algorithm = array(substr($algorithm, 0, $pos), substr($algorithm, $pos + 2)); 391 415 } 416 392 417 if (!is_callable($algorithm)) 393 418 { 394 419 throw new sfException(sprintf('The algorithm callable "%s" is not callable.', $algorithm)); 395 420 } 396 421 397 422 return $this->getPassword() == call_user_func_array($algorithm, array($this->getSalt().$password)); 398 423 } … … 652 677 try 653 678 { 654 $profile = $this->getProfile(); 655 if ($profile) 656 { 657 $profile->delete($con); 679 if ($profile = $this->getProfile()) 680 { 681 $profile->delete(); 658 682 } 659 683 }
