Skip to content

Commit

Permalink
Impossible de se co si inactif (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
prytoegrian authored Mar 10, 2018
1 parent f9dbac1 commit 7623b65
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions Authentification/AuthentificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function get(IRequest $request, IResponse $response, array $arguments)
$utilisateur = $this->repository->find([
'login' => $login,
'password' => $password,
'isActif' => true,
]);
$utilisateurUpdated = $this->repository->regenerateToken($utilisateur);
} catch (\UnexpectedValueException $e) {
Expand Down
4 changes: 4 additions & 0 deletions Utilisateur/UtilisateurDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ private function setWhere(array $parametres)
$this->queryBuilder->andWhere('date_last_access >= :gt_date_last_access');
$this->queryBuilder->setParameter(':gt_date_last_access', $parametres['gt_date_last_access']);
}
if (!empty($parametres['is_active'])) {
$this->queryBuilder->andWhere('u_is_active = :actif');
$this->queryBuilder->setParameter(':actif', ($parametres['is_active']) ? 'Y' : 'N');
}
}

/**
Expand Down
3 changes: 3 additions & 0 deletions Utilisateur/UtilisateurRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ final protected function getParamsConsumer2Dao(array $paramsConsumer)
if (!empty($paramsConsumer['gt_date_last_access'])) {
$results['gt_date_last_access'] = (string) $paramsConsumer['gt_date_last_access'];
}
if (!empty($paramsConsumer['isActif'])) {
$results['is_active'] = $paramsConsumer['isActif'];
}
return $results;
}

Expand Down

0 comments on commit 7623b65

Please sign in to comment.