Development

Changeset 16030 for plugins/sfDoctrineGuardExtraPlugin

You must first sign up to be able to contribute.

Show
Ignore:
Timestamp:
03/05/09 16:24:36 (4 years ago)
Author:
gimler
Message:

sfDoctrineGuardExtraPlugin: optimize code

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfDoctrineGuardExtraPlugin/branches/1.1/modules/sfGuardForgotPassword/lib/BasesfGuardForgotPasswordActions.class.php

    r13284 r16030  
    9494    $params = array($request->getParameter('key'), $request->getParameter('id')); 
    9595 
    96     $query = new Doctrine_Query(); 
    97     $query->from('sfGuardUser u')->where('u.password = ? AND u.id = ?', $params)->limit(1); 
     96    $this->sfGuardUser = Doctrine_Query::create() 
     97      ->from('sfGuardUser u') 
     98      ->where('u.password = ? AND u.id = ?', $params) 
     99      ->limit(1) 
     100      ->fetchOne(); 
    98101 
    99     $this->sfGuardUser = $query->execute()->getFirst(); 
    100  
    101     if ( ! $this->sfGuardUser) 
    102     { 
    103       $this->forward('sfGuardForgotPassword', 'invalid_key'); 
    104     } 
     102    $this->forwardUnless($this->sfGuardUser, 'sfGuardForgotPassword', 'invalid_key'); 
    105103 
    106104    $newPassword = time(); 
  • plugins/sfDoctrineGuardExtraPlugin/branches/1.1/modules/sfGuardRegister/lib/BasesfGuardRegisterActions.class.php

    r12951 r16030  
    7979    $params = array($request->getParameter('key'), $request->getParameter('id')); 
    8080 
    81     $query = new Doctrine_Query(); 
    82     $query->from('sfGuardUser u')->where('u.password = ? AND u.id = ?', $params)->limit(1); 
     81    $sfGuardUser = Doctrine_Query::create() 
     82      ->from('sfGuardUser u') 
     83      ->where('u.password = ? AND u.id = ?', $params) 
     84      ->limit(1) 
     85      ->fetchOne(); 
    8386 
    84     $sfGuardUser = $query->execute()->getFirst(); 
     87    $this->forward404Unless($sfGuardUser); 
     88 
    8589    $sfGuardUser->setIsActive(1); 
    8690    $sfGuardUser->save(); 
    87  
    88     $this->forward404Unless($sfGuardUser); 
    8991 
    9092    $messageParams = array( 
  • plugins/sfDoctrineGuardExtraPlugin/branches/1.2/modules/sfGuardForgotPassword/lib/BasesfGuardForgotPasswordActions.class.php

    r13284 r16030  
    9494    $params = array($request->getParameter('key'), $request->getParameter('id')); 
    9595 
    96     $query = new Doctrine_Query(); 
    97     $query->from('sfGuardUser u')->where('u.password = ? AND u.id = ?', $params)->limit(1); 
     96    $this->sfGuardUser = Doctrine_Query::create() 
     97      ->from('sfGuardUser u') 
     98      ->where('u.password = ? AND u.id = ?', $params) 
     99      ->limit(1) 
     100      ->fetchOne(); 
    98101 
    99     $this->sfGuardUser = $query->execute()->getFirst(); 
    100  
    101     if ( ! $this->sfGuardUser) 
    102     { 
    103       $this->forward('sfGuardForgotPassword', 'invalid_key'); 
    104     } 
     102    $this->forwardUnless($this->sfGuardUser, 'sfGuardForgotPassword', 'invalid_key'); 
    105103 
    106104    $newPassword = time(); 
  • plugins/sfDoctrineGuardExtraPlugin/branches/1.2/modules/sfGuardRegister/lib/BasesfGuardRegisterActions.class.php

    r12951 r16030  
    7979    $params = array($request->getParameter('key'), $request->getParameter('id')); 
    8080 
    81     $query = new Doctrine_Query(); 
    82     $query->from('sfGuardUser u')->where('u.password = ? AND u.id = ?', $params)->limit(1); 
     81    $sfGuardUser = Doctrine_Query::create() 
     82      ->from('sfGuardUser u') 
     83      ->where('u.password = ? AND u.id = ?', $params) 
     84      ->limit(1) 
     85      ->fetchOne(); 
    8386 
    84     $sfGuardUser = $query->execute()->getFirst(); 
     87    $this->forward404Unless($sfGuardUser); 
     88 
    8589    $sfGuardUser->setIsActive(1); 
    8690    $sfGuardUser->save(); 
    87  
    88     $this->forward404Unless($sfGuardUser); 
    8991 
    9092    $messageParams = array(