Esempio n. 1
0
 /**
  * @test
  * @group userservice
  */
 public function should_reset_password()
 {
     $n_pwd = 'new_password';
     $n_hashed = bcrypt($n_pwd);
     $this->hasher->shouldReceive('make')->andReturn($n_hashed);
     $this->userRepo->shouldReceive('update');
     $r_user = $this->userService->resetPassword($this->karl, $n_pwd);
     $this->assertEquals($n_hashed, $r_user->getAuthPassword());
 }
Esempio n. 2
0
 /**
  * Resets the password of a given user
  *
  * @param $userId
  * @param Request $request
  * @return User
  */
 public function resetPassword($orgId, $userId, Request $request)
 {
     $password = $request->input('password');
     $user = $this->userService->userOfId($userId);
     if ($user) {
         $user = $this->userService->resetPassword($user, $password);
         return $this->jsonResponse($user);
     } else {
         abort(404, 'User with id [' . $user . '] not found.');
     }
 }