diff options
| author | polo <ordipolo@gmx.fr> | 2025-05-21 22:17:12 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-05-21 22:17:12 +0200 |
| commit | 5b85933ab78fa96600af095b5682f0341a0372b7 (patch) | |
| tree | 1b82e86949cf6b043e4c048e420ebe422cdc32f5 | |
| parent | f452a7f6898a5c29519a6f1557fc8d4aa176954c (diff) | |
| download | cms-5b85933ab78fa96600af095b5682f0341a0372b7.tar.gz cms-5b85933ab78fa96600af095b5682f0341a0372b7.tar.bz2 cms-5b85933ab78fa96600af095b5682f0341a0372b7.zip | |
en fait ça va
| -rw-r--r-- | src/controller/password.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/controller/password.php b/src/controller/password.php index 074ffb1..4748d9d 100644 --- a/src/controller/password.php +++ b/src/controller/password.php | |||
| @@ -61,7 +61,6 @@ function createPassword(EntityManager $entityManager) | |||
| 61 | } | 61 | } |
| 62 | else | 62 | else |
| 63 | { | 63 | { |
| 64 | // -> caractères HTML dangereux supprimés | ||
| 65 | $login = Security::secureString($_POST['login']); | 64 | $login = Security::secureString($_POST['login']); |
| 66 | $password = Security::secureString($_POST['password']); | 65 | $password = Security::secureString($_POST['password']); |
| 67 | 66 | ||
| @@ -85,6 +84,8 @@ function createPassword(EntityManager $entityManager) | |||
| 85 | else | 84 | else |
| 86 | { | 85 | { |
| 87 | $error = 'bad_password'; | 86 | $error = 'bad_password'; |
| 87 | |||
| 88 | // compteur dans la session et blocage de compte | ||
| 88 | } | 89 | } |
| 89 | } | 90 | } |
| 90 | 91 | ||
| @@ -154,14 +155,15 @@ function connect(LoginBuilder $builder, EntityManager $entityManager) | |||
| 154 | } | 155 | } |
| 155 | else // c'est OK | 156 | else // c'est OK |
| 156 | { | 157 | { |
| 157 | $login = $_POST['login']; | 158 | $login = Security::secureString($_POST['login']); |
| 158 | $password = htmlspecialchars($_POST['password']); | 159 | $password = Security::secureString($_POST['password']); |
| 159 | $user = getUser($login, $entityManager); | 160 | $user = getUser($login, $entityManager); |
| 160 | 161 | ||
| 161 | // enregistrement et redirection | 162 | // enregistrement et redirection |
| 162 | if(!empty($user) && $login === $user->getLogin() && password_verify($password, $user->getPassword())) | 163 | if(!empty($user) && $login === $user->getLogin() && password_verify($password, $user->getPassword())) |
| 163 | { | 164 | { |
| 164 | session_start(); | 165 | session_start(); |
| 166 | session_regenerate_id(true); // protection fixation de session, si l'attaquant a créé un cookie de session (attaque XSS), il est remplacé | ||
| 165 | $_SESSION['user'] = $login; | 167 | $_SESSION['user'] = $login; |
| 166 | $_SESSION['admin'] = true; | 168 | $_SESSION['admin'] = true; |
| 167 | $link = new URL(isset($_GET['from']) ? ['page' => $_GET['from']] : []); | 169 | $link = new URL(isset($_GET['from']) ? ['page' => $_GET['from']] : []); |
