Author: sevein
Date: Mon Jan 30 10:52:17 2012
New Revision: 10776

Log:
Extend the funcionality to tools:reset-password so a password can be also 
regenerated given its e-mail address

Modified:
   trunk/lib/task/resetPasswordTask.class.php

Modified: trunk/lib/task/resetPasswordTask.class.php
==============================================================================
--- trunk/lib/task/resetPasswordTask.class.php  Mon Jan 30 10:24:03 2012        
(r10775)
+++ trunk/lib/task/resetPasswordTask.class.php  Mon Jan 30 10:52:17 2012        
(r10776)
@@ -22,7 +22,7 @@
   protected function configure()
   {
     $this->addArguments(array(
-      new sfCommandArgument('username', sfCommandArgument::REQUIRED, 
'Username')
+      new sfCommandArgument('username', sfCommandArgument::REQUIRED, 
'Username/E-Mail')
     ));
 
     $this->addOptions(array(
@@ -33,7 +33,7 @@
 
     $this->namespace = 'tools';
     $this->name = 'reset-password';
-    $this->briefDescription = 'Generates a new password for a given username';
+    $this->briefDescription = 'Generates a new password for a given username 
or e-mail address';
     $this->detailedDescription = <<<EOF
 FIXME
 EOF;
@@ -45,7 +45,9 @@
     $conn = $databaseManager->getDatabase('propel')->getConnection();
 
     $criteria = new Criteria;
-    $criteria->add(QubitUser::USERNAME, $arguments['username']);
+    $c1 = $criteria->getNewCriterion(QubitUser::USERNAME, 
$arguments['username']);
+    $c2 = $criteria->getNewCriterion(QubitUser::EMAIL, $arguments['username']);
+    $criteria->add($c1->addOr($c2));
     $user = QubitUser::getOne($criteria);
 
     // User account exists?

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to