From 9d39c22a8852e555e9aeb4c5486ae5a959899678 Mon Sep 17 00:00:00 2001 From: beaulaton Date: Wed, 27 Nov 2024 09:33:47 +0100 Subject: [PATCH 1/2] =?UTF-8?q?On=20peut=20changer=20les=20donn=C3=A9es=20?= =?UTF-8?q?mais=20pas=20de=20lien=20avec=20la=20bdd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 2 +- public/script/changeData.js | 23 ++++++----------------- src/Controleur/FrontControler.php | 2 +- src/Controleur/UserControler.php | 6 +++--- src/Controleur/VisitorControler.php | 2 +- vue/profil.php | 2 +- vue/templates/login.html | 1 - vue/templates/profil.html.twig | 9 ++++----- 8 files changed, 17 insertions(+), 30 deletions(-) diff --git a/index.php b/index.php index a490e89..b625fbe 100644 --- a/index.php +++ b/index.php @@ -24,7 +24,7 @@ $twig = new \Twig\Environment($loader, [ 'cache' => false, ]); -$twig->addGlobal('racine','/~kekentin/WF/WF-Website'); +$twig->addGlobal('racine','/~lebeaulato/WF-Website'); // /~kekentin/WF/WF-Website $cont = new Controleur\FrontControler($co); diff --git a/public/script/changeData.js b/public/script/changeData.js index a3bbc32..e76bb9f 100644 --- a/public/script/changeData.js +++ b/public/script/changeData.js @@ -1,6 +1,7 @@ function editFieldUsername(id) { var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant + var currentValue = pElement.textContent.trim();// Obtenir le texte actuel du

// Créer un champ de saisie avec la valeur actuelle @@ -65,13 +66,7 @@ function saveFieldEmail(id, newValue) { return; // Ne pas sauvegarder si l'email n'est pas valide } } - if (id === 'username') { - if (newValue.trim() === "") { - alert('Le nom d\'utilisateur ne peut pas être vide.'); - document.getElementById(id).querySelector('input').focus(); - return; // Ne pas sauvegarder si le nom d'utilisateur est vide - } - } + var pElement = document.getElementById(id); // Récupérer l'élément

via son identifiant @@ -141,8 +136,7 @@ function editFieldPassWd(id) { function savePasswordFields(id, newPassword, confirmPassword) { // Vérification si les champs sont vides if (newPassword.trim() === "" || confirmPassword.trim() === ""){ - alert("Les champs de mot de passe ne doivent pas être vides."); - return; + alert("Le mot de passe n'a pas changé"); } // Vérification de la correspondance des deux mots de passe @@ -150,18 +144,13 @@ function savePasswordFields(id, newPassword, confirmPassword) { var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant - if(newPassword.length >= 16){ - var maskedPassword = '*'.repeat(16); // Masquer le nouveau mot de passe pour l'affichage - } - else{ - var maskedPassword = "*".repeat(newPassword.length); // Masquer le nouveau mot de passe pour l'affichage - } + // Remplacer les champs input par le texte masqué - pElement.innerHTML = '' + maskedPassword + ' '; + pElement.innerHTML ='Votre mot de passe'; alert('Mot de passe mis à jour avec succès'); - // Possibilité d'ajouter ici une fonction pour envoyer les nouveaux mots de passe au serveur + // fonction pour envoyer les nouveaux mots de passe au serveur } else { alert('Les mots de passe ne correspondent pas.'); diff --git a/src/Controleur/FrontControler.php b/src/Controleur/FrontControler.php index bb7f233..b4cddcd 100644 --- a/src/Controleur/FrontControler.php +++ b/src/Controleur/FrontControler.php @@ -19,7 +19,7 @@ Class FrontControler{ $dVueEreur = []; $router = new \AltoRouter(); - $router->setBasePath('/~kekentin/WF/WF-Website'); + $router->setBasePath('/~lebeaulato/WF-Website'); ///~kekentin/WF/WF-Website $router->map('GET', '/', 'VisitorControler','accueil'); diff --git a/src/Controleur/UserControler.php b/src/Controleur/UserControler.php index 58cd581..6eb68ec 100644 --- a/src/Controleur/UserControler.php +++ b/src/Controleur/UserControler.php @@ -49,7 +49,7 @@ class UserControler { public function addComment(){ $id = $_POST['idQuote']; $this->cMod->createComment($_POST['content'],$_POST['idQuote'],$this->uMod->getIdByUsername($_SESSION['user'])); - header("Location: /~kekentin/WF/WF-Website/quote/$id"); + header("Location: /~lebeaulato/WF-Website/quote/$id"); } @@ -67,7 +67,7 @@ class UserControler { session_unset(); session_destroy(); $_SESSION = array(); - header("Location: /~kekentin/WF/WF-Website/"); + header("Location: /~lebeaulato/WF-Website/"); } public function quiz(array $args){ @@ -109,7 +109,7 @@ class UserControler { session_destroy(); $this->endQuiz($id_quiz, $score); } - else header("Location: /~kekentin/WF/WF-Website/quiz/$id_quiz"); + else header("Location: /~lebeaulato/WF-Website/quiz/$id_quiz"); ///~kekentin/WF/WF-Website } diff --git a/src/Controleur/VisitorControler.php b/src/Controleur/VisitorControler.php index 22a8191..fea371b 100644 --- a/src/Controleur/VisitorControler.php +++ b/src/Controleur/VisitorControler.php @@ -125,7 +125,7 @@ Class VisitorControler { { $_SESSION['user'] = $pseudo; $_SESSION['role'] = 'user'; - header("Location: /~kekentin/WF/WF-Website/"); + header("Location: /~lebeaulato/WF-Website/"); ///~kekentin/WF/WF-Website/ exit(); }else { diff --git a/vue/profil.php b/vue/profil.php index 5dffffb..6ce71ee 100644 --- a/vue/profil.php +++ b/vue/profil.php @@ -5,7 +5,7 @@ echo $twig->render('head.html.twig', [ 'title' => "Profil", 'style' => "public/styles/styleProfil.css", - 'scripts' => array("public/script/theme-toggle.js") + 'scripts' => array("public/script/theme-toggle.js", "public/script/changeData.js") ]); diff --git a/vue/templates/login.html b/vue/templates/login.html index 8da6981..361f604 100644 --- a/vue/templates/login.html +++ b/vue/templates/login.html @@ -15,7 +15,6 @@

▶ Connexion ◀

-

Identifiant *

diff --git a/vue/templates/profil.html.twig b/vue/templates/profil.html.twig index 4f54010..26dc88b 100644 --- a/vue/templates/profil.html.twig +++ b/vue/templates/profil.html.twig @@ -4,14 +4,13 @@ +

{{ srcUsername }}

+ +

{{ srcEmail }}

-

{{ srcUsername }}

- - -

{{ srcEmail }}

+

Votre mot de passe

-

mot de passe

From 6ba6df5ed320dd7773d0ba1c9f61a7eb7f5cc38f Mon Sep 17 00:00:00 2001 From: beaulaton Date: Wed, 27 Nov 2024 09:58:31 +0100 Subject: [PATCH 2/2] little quote --- src/Gateway/QuoteGateway.php | 14 ++++++++------ vue/templates/quoteLittle.html.twig | 10 +++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Gateway/QuoteGateway.php b/src/Gateway/QuoteGateway.php index f04318a..86a33b6 100644 --- a/src/Gateway/QuoteGateway.php +++ b/src/Gateway/QuoteGateway.php @@ -74,12 +74,14 @@ Class QuoteGateway{ public function getQuoteOfTheDay(string $language): array { $query = "SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dateS, q.likes, q.langue - FROM Quote q - JOIN Caracter c ON c.id_caracter = q.id_caracter - JOIN Source s ON s.id_source = q.id_source - JOIN Image i ON c.id_img = i.id_img - WHERE q.isValide = true AND q.isCitationDuJour = true AND q.langue = :language - ORDER BY id_quote DESC LIMIT 1;"; + FROM DailyQuote dq + JOIN Quote q ON dq.citation_id = q.id_quote + JOIN Caracter c ON c.id_caracter = q.id_caracter + JOIN Source s ON s.id_source = q.id_source + JOIN Image i ON c.id_img = i.id_img + WHERE q.isValide = true AND q.langue = :language + ORDER BY q.id_quote DESC + LIMIT 1;"; try { $this->con->executeQuery($query, [':language' => [$language, PDO::PARAM_STR]]); $result = $this->con->getResults(); diff --git a/vue/templates/quoteLittle.html.twig b/vue/templates/quoteLittle.html.twig index bc9f397..bfeacb6 100644 --- a/vue/templates/quoteLittle.html.twig +++ b/vue/templates/quoteLittle.html.twig @@ -2,14 +2,14 @@ {% if quotes|length > 0 %}