Author: allyb
Date: 2010-01-22 11:11:26 +0100 (Fri, 22 Jan 2010)
New Revision: 27034

Modified:
   
plugins/sfEasyAuthPlugin/trunk/modules/sfEasyAuth/lib/BasesfEasyAuthActions.class.php
Log:
Added extra events to the base action class re sending password reminders

Modified: 
plugins/sfEasyAuthPlugin/trunk/modules/sfEasyAuth/lib/BasesfEasyAuthActions.class.php
===================================================================
--- 
plugins/sfEasyAuthPlugin/trunk/modules/sfEasyAuth/lib/BasesfEasyAuthActions.class.php
       2010-01-22 10:00:08 UTC (rev 27033)
+++ 
plugins/sfEasyAuthPlugin/trunk/modules/sfEasyAuth/lib/BasesfEasyAuthActions.class.php
       2010-01-22 10:11:26 UTC (rev 27034)
@@ -254,7 +254,20 @@
       else
       {
         
$this->setFlash(sfConfig::get('app_sf_easy_auth_reset_user_not_found'));
-        $this->redirect(sprintf('%s?%s=true', 
$this->generateUrl('sf_easy_auth_login'), 
+
+        $url = $this->generateUrl('sf_easy_auth_login');
+
+        // call an event before redirecting users if a password reset form is 
not valid
+        $url = $this->getContext()->getEventDispatcher()->filter(new sfEvent(
+          $this,
+          'sf_easy_auth.filter_password_reset_error_url',
+          array(
+            'sfUser'  => $this->getUser(),
+            'request' => $request
+          )
+        ), $url)->getReturnValue();
+
+        $this->redirect(sprintf('%s?%s=true', $url,
           sfConfig::get('app_sf_easy_auth_reset_user_not_found_url_token')));
       }
     }
@@ -343,8 +356,21 @@
    */
   protected function sendPasswordResetMessage(sfEasyAuthUser $eaUser)
   {
-    $message = $this->getPartial('sfEasyAuth/passwordResetEmail', 
array('eaUser' => $eaUser));
-    $htmlMessage = $this->getPartial('sfEasyAuth/passwordResetEmailHtml', 
array('eaUser' => $eaUser));
+    $message = 'sfEasyAuth/passwordResetEmail';
+    $htmlMessage = 'sfEasyAuth/passwordResetEmailHtml';
+
+    // call an event before sending a password reset message to allow the 
messages to be changed
+    list($message, $htmlMessage) = 
$this->getContext()->getEventDispatcher()->filter(new sfEvent(
+      $this,
+      'sf_easy_auth.filter_password_reset_messages',
+      array(
+        'eaUser' => $eaUser,
+      )
+    ), array($message, $htmlMessage))->getReturnValue();
+
+    $message = $this->getPartial($message, array('eaUser' => $eaUser));
+    $htmlMessage = $this->getPartial($htmlMessage, array('eaUser' => $eaUser));
+
     return $eaUser->sendPasswordResetMessage($message, $htmlMessage);
   }
 }

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" 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/symfony-svn?hl=en.

Reply via email to