diff --git a/src/bb-modules/Client/Api/Guest.php b/src/bb-modules/Client/Api/Guest.php index 47f87afed..df9ead840 100644 --- a/src/bb-modules/Client/Api/Guest.php +++ b/src/bb-modules/Client/Api/Guest.php @@ -248,7 +248,7 @@ class Guest extends \Api_Abstract $new_pass = substr(md5(time() . uniqid()), 0, 10); $c = $this->di['db']->load('Client', $reset->client_id); - $c->pass = $new_pass; + $c->pass = $this->di['password']->hashIt($new_pass); $this->di['db']->store($c); //send email diff --git a/tests/bb-modules/Client/Api/GuestTest.php b/tests/bb-modules/Client/Api/GuestTest.php index e31d0b8b8..f4f296a97 100644 --- a/tests/bb-modules/Client/Api/GuestTest.php +++ b/tests/bb-modules/Client/Api/GuestTest.php @@ -329,10 +329,15 @@ class GuestTest extends \PHPUnit_Framework_TestCase { $emailServiceMock->expects($this->atLeastOnce())-> method('sendTemplate'); + $passwordMock = $this->getMockBuilder('\Box_Password')->getMock(); + $passwordMock->expects($this->atLeastOnce()) + ->method('hashIt'); + $di = new \Box_Di(); $di['db'] = $dbMock; $di['logger'] = new \Box_Log(); $di['mod_service'] = $di->protect(function ($name) use($emailServiceMock) {return $emailServiceMock;}); + $di['password'] = $passwordMock; $client = new \Box\Mod\Client\Api\Guest(); $client->setDi($di);