@@ -56,9 +56,10 @@ public function remove($m)
5656 return $ this ->getPasswordMapper ()->remove ($ m );
5757 }
5858
59- public function sendProcessForgotRequest ($ userId , $ email )
59+ public function sendProcessForgotRequest ($ user , $ email )
6060 {
6161 //Invalidate all prior request for a new password
62+ $ userId = $ user ->getId ();
6263 $ this ->cleanPriorForgotRequests ($ userId );
6364
6465 $ class = $ this ->getOptions ()->getPasswordEntityClass ();
@@ -68,20 +69,21 @@ public function sendProcessForgotRequest($userId, $email)
6869 $ this ->getEventManager ()->trigger (__FUNCTION__ , $ this , array ('record ' => $ model , 'userId ' => $ userId ));
6970 $ this ->getPasswordMapper ()->persist ($ model );
7071
71- $ this ->sendForgotEmailMessage ($ email , $ model );
72+ $ this ->sendForgotEmailMessage ($ user , $ model );
7273 }
7374
74- public function sendForgotEmailMessage ($ to , $ model )
75+ public function sendForgotEmailMessage ($ user , $ model )
7576 {
7677 $ mailService = $ this ->getServiceManager ()->get ('playgrounduser_message ' );
7778
7879 $ from = $ this ->getOptions ()->getEmailFromAddress ();
80+ $ to = $ user ->getEmail ();
7981 $ subject = $ this ->getServiceManager ()->get ('MvcTranslator ' )->translate ($ this ->getOptions ()->getResetEmailSubjectLine (), 'playgrounduser ' );
8082
8183 $ renderer = $ this ->getServiceManager ()->get ('Zend\View\Renderer\RendererInterface ' );
8284 $ skinUrl = $ renderer ->url ('frontend ' , array (), array ('force_canonical ' => true ));
8385
84- $ message = $ mailService ->createHtmlMessage ($ from , $ to , $ subject , 'playground-user/email/forgot ' , array ('record ' => $ model , 'to ' => $ to , 'skinUrl ' => $ skinUrl ));
86+ $ message = $ mailService ->createHtmlMessage ($ from , $ to , $ subject , 'playground-user/email/forgot ' , array ('record ' => $ model , 'to ' => $ to , 'skinUrl ' => $ skinUrl, ' user ' => $ user ));
8587
8688 $ mailService ->send ($ message );
8789 }
0 commit comments