You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
<?php
|
|
namespace Manager;
|
|
use Manager\IGenericDataManager;
|
|
use Service\IAuthService;
|
|
use Utils\Validation;
|
|
// c'est le modéle
|
|
class UserManager {
|
|
private IAuthService $authService;
|
|
public function __construct(IAuthService $authService){}
|
|
|
|
public function login($loginUser,$passwordUser): bool{
|
|
if(!Validation::val_string($passwordUser) || !Validation::val_string($loginUser)) throw new \Exception(" some wrong with cred !!!!!");
|
|
if($this->authService->login($loginUser,$passwordUser)){
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public function resgister($loginUser,$passwordUser): bool{
|
|
if(!Validation::val_string($passwordUser) || !Validation::val_string($loginUser)) throw new \Exception(" some wrong with cred !!!!!");
|
|
if($this->authService->register($loginUser,$passwordUser)){
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public function deconnecter():bool{
|
|
try {
|
|
$this->authService->logoutUser();
|
|
return true;
|
|
} catch (\Exception $e) {
|
|
return false;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
?>
|