public function testShouldDeletePasswordReminderEmailByToken()
 {
     // Make sure that our user will recieve confirm
     $database = m::mock('DatabaseManager');
     $database->shouldReceive('connection')->andReturn($database)->once()->getMock()->shouldReceive('table')->with('password_reminders')->andReturn($database)->once()->getMock()->shouldReceive('select')->with('email')->andReturn($database)->once()->getMock()->shouldReceive('where')->with('token', '=', '456456')->andReturn($database)->once()->getMock()->shouldReceive('delete')->once();
     $this->repo->app['db'] = $database;
     $this->assertNull($this->repo->deleteEmailByReminderToken('456456'));
 }
 public function testShouldDeletePasswordReminderEmailByToken()
 {
     // Make sure that the password reminders collection will receive a remove
     $database = $this->repo->app['MongoLidConnector'];
     $database->password_reminders = $database;
     // The collection that should be accessed
     $database->shouldReceive('remove')->with(array('token' => '456456'))->andReturn(null)->once();
     $this->repo->app['MongoLidConnector'] = $database;
     $this->assertNull($this->repo->deleteEmailByReminderToken('456456'));
 }
Пример #3
0
 /**
  * Change user password
  *
  * @return string
  */
 public function resetPassword($params)
 {
     $token = array_get($params, 'token', '');
     $email = $this->repo->getEmailByReminderToken($token);
     $user = $this->repo->getUserByMail($email);
     if ($user) {
         if ($user->resetPassword($params)) {
             // Password reset success, remove token from database
             $this->repo->deleteEmailByReminderToken($token);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }