From af3d102605886c1bf49ea8492a2fa1bb27f97c0b Mon Sep 17 00:00:00 2001 From: Loris BALOCCHI Date: Mon, 10 Jun 2024 16:24:30 +0200 Subject: [PATCH] fix: update login/register links in login page The login page has been updated to fix the broken links for creating a new account and logging in. The links now correctly point to the register and login pages in the account directory. Co-authored-by: Charpentier Juliette --- account/login/index.php | 2 +- account/login/login.php | 70 +++++++++++++++++++++++++++++++---- account/register/index.php | 21 ++++++----- account/register/register.php | 47 +++++++++++++++++++++++ 4 files changed, 121 insertions(+), 19 deletions(-) create mode 100644 account/register/register.php diff --git a/account/login/index.php b/account/login/index.php index 99b6e21..1fcb6d0 100644 --- a/account/login/index.php +++ b/account/login/index.php @@ -37,7 +37,7 @@ - diff --git a/account/login/login.php b/account/login/login.php index 8784f00..7ddde1d 100644 --- a/account/login/login.php +++ b/account/login/login.php @@ -5,14 +5,68 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $email = htmlspecialchars($_POST["email"]); $password = htmlspecialchars($_POST["password"]); } -/*- check la validité du combo mail + mdp (qui es thashé sur la bdd)*/ -/*- si valide, on enregistre un cookie avec mail, nom, prénom, rôle (requete sql pour les obtenir)*/ -/*- créer un cookie avec mail, nom, prénom, rôle. Qui expire dans 1h*/ -/* une fois bien connecté, on redirige vers /account/profile */ - -echo "adresse mail : " . $email . "
"; -echo "mot de passe : " . $password . "
"; +?> + \ No newline at end of file + setcookie("savemdp", $savemdp, time() + 3600); +}*/ +?> + +/* +hasher le mdp +- check la validité du combo mail + mdp (qui es thashé sur la bdd) +- si valide, on enregistre un cookie avec mail, nom, prénom, rôle (requete sql pour les obtenir) +- créer un cookie avec mail, nom, prénom, rôle. Qui expire dans 1h +une fois bien connecté, on redirige vers /account/profile +*/ + + + + + + + +
+ "; + echo "mot de passe : " . $password . "
"; + /*test loris*/ + $query = "SELECT mail, password FROM user + WHERE mail = '$email'"; + $result = mysqli_query($db, $query); + + if (!$result) { + die("Erreur lors de l'exécution de la requête."); + } + + $row = mysqli_fetch_assoc($result); + $storedPassword = $row['password']; + + if (password_verify($password, $storedPassword)) { + // Authentication successful + // Set the necessary cookies and redirect to /account/profile + // ... + } else { + die("Combinaison email/mot de passe incorrecte."); + } + ?> + + Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that + corresponds to + your MariaDB server version for the right syntax to use near '@fesse.fr AND password = + $2y$10$whzDnlmJvcSJdXqkr7SoAu5B7gmxJgcVPNT3Nr9oAPMAd...' at line 3 in + C:\Users\Loris\Documents\DEV\gitea\SAE_web\account\login\login.php:28 Stack trace: #0 + C:\Users\Loris\Documents\DEV\gitea\SAE_web\account\login\login.php(28): mysqli_query(Object(mysqli), 'SELECT + mail, + pa...') #1 {main} thrown in C:\Users\Loris\Documents\DEV\gitea\SAE_web\account\login\login.php on line 28 \ No newline at end of file diff --git a/account/register/index.php b/account/register/index.php index bd7f29c..106bf69 100644 --- a/account/register/index.php +++ b/account/register/index.php @@ -31,32 +31,33 @@

Créez un nouveau compte afin d'accéder à l'entièreté du site.

- +
- +
- +
- +
+ +
- - + +
- -
- + + diff --git a/account/register/register.php b/account/register/register.php new file mode 100644 index 0000000..0919ebd --- /dev/null +++ b/account/register/register.php @@ -0,0 +1,47 @@ + \ No newline at end of file