|
|
|
@ -15,13 +15,13 @@ class UserManager
|
|
|
|
|
{
|
|
|
|
|
private IAuthService $authService;
|
|
|
|
|
|
|
|
|
|
private IFriendRequestService $friendService;
|
|
|
|
|
// private IFriendRequestService $friendService;
|
|
|
|
|
|
|
|
|
|
private User $currentUser;
|
|
|
|
|
|
|
|
|
|
private UserRepository $userRepo;
|
|
|
|
|
|
|
|
|
|
public function __construct(IAuthService $authService,IFriendRequestService $friendService)
|
|
|
|
|
public function __construct(IAuthService $authService)
|
|
|
|
|
{
|
|
|
|
|
$this->authService = $authService;
|
|
|
|
|
}
|
|
|
|
@ -32,6 +32,7 @@ class UserManager
|
|
|
|
|
if (!Validation::val_string($passwordUser) || !Validation::val_string($loginUser))
|
|
|
|
|
throw new \Exception(" some wrong with cred !!!!!");
|
|
|
|
|
if ($this->authService->login($loginUser, $passwordUser)) {
|
|
|
|
|
$this->currentUser = $this->userRepo->GetItemByName($loginUser,0,1);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
@ -90,6 +91,7 @@ class UserManager
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($this->authService->register($loginUser, $passwordUser, $data)) {
|
|
|
|
|
$this->currentUser = $this->userRepo->GetItemByName($loginUser,0,1);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
@ -104,8 +106,8 @@ class UserManager
|
|
|
|
|
}
|
|
|
|
|
public function searchUsersByName(string $name) : array{
|
|
|
|
|
$list=array();
|
|
|
|
|
$friendsList=$this->currentUser->getFriendsList();
|
|
|
|
|
foreach($u as $friendsList){
|
|
|
|
|
$usersList=$this->currentUser->getItems();
|
|
|
|
|
foreach($u as $usersList){
|
|
|
|
|
if(strcasecmp($name,$u->getNom())==0 || strcasecmp($name,$u->getPrenom())==0){
|
|
|
|
|
array_push($list, $u);
|
|
|
|
|
}
|
|
|
|
|