From c380ef7cff45f9a56e70df199cd29620f8b85713 Mon Sep 17 00:00:00 2001 From: "maxime.rocher" Date: Fri, 10 Jan 2025 08:39:04 +0100 Subject: [PATCH 1/3] =?UTF-8?q?modif=20degr=C3=A9d=C3=A9=20:dead:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.php | 4 ++-- index.php | 4 ++-- public/styles/style.css | 8 ++++---- vue/templates/quiz.html.twig | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config/config.php b/config/config.php index 13c4fe2..1a2bbb9 100644 --- a/config/config.php +++ b/config/config.php @@ -12,8 +12,8 @@ $base = ''; $login = ''; $mdp = ''; -$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website -//$racine='/WF-Website'; +//$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website +$racine='/WF-Website'; //Vues diff --git a/index.php b/index.php index 33bc65b..2de51d3 100644 --- a/index.php +++ b/index.php @@ -15,8 +15,8 @@ if(!isset($_SESSION['theme'])){ require_once __DIR__ . '/config/config.php'; require __DIR__ . '/vendor/autoload.php'; -//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=postgres;', 'postgres', 'sucepute'); -$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); +$co = new \Gateway\Connection('pgsql:host=localhost;dbname=wikifantasy3;', 'postgres', 'postgres'); +//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); //twig $loader = new \Twig\Loader\FilesystemLoader('vue/templates'); diff --git a/public/styles/style.css b/public/styles/style.css index c265563..76d9ab8 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -6,13 +6,13 @@ --main-dark-gradient : linear-gradient(45deg, #4a148c, #7b1fa2); --main-dark-other-color : #000000; - --main-light-background-color: #ffffff; + --main-light-background-color: #cccccc; /*--main-light-background-color: #ffffff;*/ - --main-light-text-color : #000000; - --main-light-gradient : linear-gradient(90deg, #78b3eb, #64c1ff); + --main-light-text-color : #000; + --main-light-gradient : linear-gradient(90deg, #46BE73, #BAEBF6); /*--main-light-gradient : linear-gradient(-90deg, #f3e0f7, #dd9aff);*/ /*--main-light-gradient : linear-gradient(45deg, #73CFF6, #DE95CA);*/ - --main-light-other-color : #f8eaff; + --main-light-other-color : #46BE73; /*--main-light-other-color : #f8eaff;*/ /*--main-light-other-color : #d2d2d8;*/ } diff --git a/vue/templates/quiz.html.twig b/vue/templates/quiz.html.twig index 72531de..eb572fc 100644 --- a/vue/templates/quiz.html.twig +++ b/vue/templates/quiz.html.twig @@ -1,7 +1,7 @@

Quiz

{{ question.question }}

- 10 seconds left .. + {# 10 seconds left .. #}
From a0e05c50823b32ccbbb47c16d43a8889509ab384 Mon Sep 17 00:00:00 2001 From: beaulaton Date: Fri, 10 Jan 2025 09:25:57 +0100 Subject: [PATCH 2/3] Ajout de l'envoie de l'email --- config/config.php | 2 +- src/Controleur/VisitorControler.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/config/config.php b/config/config.php index 13c4fe2..2cc6cad 100644 --- a/config/config.php +++ b/config/config.php @@ -12,7 +12,7 @@ $base = ''; $login = ''; $mdp = ''; -$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website +$racine='/~lebeaulato/WF-Website'; // /~kekentin/WF/WF-Website //$racine='/WF-Website'; diff --git a/src/Controleur/VisitorControler.php b/src/Controleur/VisitorControler.php index 99589af..ad292fe 100644 --- a/src/Controleur/VisitorControler.php +++ b/src/Controleur/VisitorControler.php @@ -195,6 +195,7 @@ Class VisitorControler { exit(); } else echo $this->uMod->insertUser($pseudo, $email, $hmdp); + $this->sendEmail($pseudo,$email); $_SESSION["role"] = Verification::verifChar('user'); $_SESSION["user"] = Verification::verifChar($pseudo); @@ -202,4 +203,22 @@ Class VisitorControler { header("Location: ". $racine); } } + + public function sendEmail(string $pseudo, string $email) : void{ + $to = $email; // Adresse email de destination + $subject = "What The Fantasy - Création de compte"; // Sujet de l'email + $message = " + Bonjour $pseudo, + + Merci de vous être inscrit sur notre site What The Fantasy. C’est avec grande joie que nous vous accueillons au sein de notre confrérie, pour découvrir ensemble... + + À bientôt ! + L'équipe du site + "; // Contenu de l'email + $headers = "From: noreply@whatTheFantasy.com"; // Adresse email de l'expéditeur + + // Envoyer l'email + mail($to, $subject, $message, $headers); + + } } \ No newline at end of file From cf61ee55bae9960ff0d954827d315ad0664ea7ce Mon Sep 17 00:00:00 2001 From: beaulaton Date: Fri, 10 Jan 2025 10:09:29 +0100 Subject: [PATCH 3/3] =?UTF-8?q?Envoie=20email=20=C3=A0=20la=20connexion=20?= =?UTF-8?q?du=20compte=20(d=C3=A9sactiv=C3=A9=20pour=20le=20moment)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.php | 4 ++-- index.php | 4 ++-- src/Controleur/VisitorControler.php | 21 +++++++++++++++++++-- src/Gateway/UserGateway.php | 6 ++++++ src/Model/UserModel.php | 5 +++++ 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/config/config.php b/config/config.php index fdd7003..f33490e 100644 --- a/config/config.php +++ b/config/config.php @@ -13,8 +13,8 @@ $login = ''; $mdp = ''; -//$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website /~lebeaulato/WF-Website -$racine='/WF-Website'; +$racine='/~lebeaulato/WF-Website'; // /~kekentin/WF/WF-Website /~lebeaulato/WF-Website /~kemondejar/WF-Website +//$racine='/WF-Website'; diff --git a/index.php b/index.php index 2de51d3..3bc9649 100644 --- a/index.php +++ b/index.php @@ -15,8 +15,8 @@ if(!isset($_SESSION['theme'])){ require_once __DIR__ . '/config/config.php'; require __DIR__ . '/vendor/autoload.php'; -$co = new \Gateway\Connection('pgsql:host=localhost;dbname=wikifantasy3;', 'postgres', 'postgres'); -//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); +//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=wikifantasy3;', 'postgres', 'postgres'); +$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); //twig $loader = new \Twig\Loader\FilesystemLoader('vue/templates'); diff --git a/src/Controleur/VisitorControler.php b/src/Controleur/VisitorControler.php index ad292fe..0b57488 100644 --- a/src/Controleur/VisitorControler.php +++ b/src/Controleur/VisitorControler.php @@ -131,6 +131,7 @@ Class VisitorControler { { $_SESSION['user'] = Verification::verifChar($pseudo); $_SESSION['role'] = 'user'; + //$this->sendEmailLogin($pseudo,$this->uMod->getEmailWithUser($pseudo)); Envoie un email pour chaque connexion header("Location: ". $racine); exit(); }else @@ -195,7 +196,7 @@ Class VisitorControler { exit(); } else echo $this->uMod->insertUser($pseudo, $email, $hmdp); - $this->sendEmail($pseudo,$email); + $this->sendEmailSignin($pseudo,$email); $_SESSION["role"] = Verification::verifChar('user'); $_SESSION["user"] = Verification::verifChar($pseudo); @@ -204,7 +205,7 @@ Class VisitorControler { } } - public function sendEmail(string $pseudo, string $email) : void{ + public function sendEmailSignin(string $pseudo, string $email) : void{ $to = $email; // Adresse email de destination $subject = "What The Fantasy - Création de compte"; // Sujet de l'email $message = " @@ -219,6 +220,22 @@ Class VisitorControler { // Envoyer l'email mail($to, $subject, $message, $headers); + } + public function sendEmailLogin(string $pseudo, string $email) : void{ + $to = $email; // Adresse email de destination + $subject = "What The Fantasy - Connexion à votre compte"; // Sujet de l'email + $message = " + Bonjour $pseudo, + + Nous avons détecté une connexion à votre compte $pseudo. Si cela vient de vous, vous pouvez ignorer ce message. Sinon, nous vous conseillons de changer votre mot de passe. + + + L'équipe du site + "; // Contenu de l'email + $headers = "From: noreply@whatTheFantasy.com"; // Adresse email de l'expéditeur + + // Envoyer l'email + mail($to, $subject, $message, $headers); } } \ No newline at end of file diff --git a/src/Gateway/UserGateway.php b/src/Gateway/UserGateway.php index cee829e..27076f2 100644 --- a/src/Gateway/UserGateway.php +++ b/src/Gateway/UserGateway.php @@ -200,5 +200,11 @@ Class UserGateway extends Gateway{ $query = 'UPDATE Users SET password=:newPassWd WHERE username=:username'; $this->co->executeQuery($query, array(':username'=>array($username, PDO::PARAM_STR), ':newPassWd'=> array($newPassWd, PDO::PARAM_STR))); } + + public function emailWithUser(string $user):array{ + $query = 'SELECT email FROM Users WHERE username = :user'; + $this->co->executeQuery($query, array(':user'=>array($user, PDO::PARAM_STR))); + return $this->co->getResults(); + } } ?> diff --git a/src/Model/UserModel.php b/src/Model/UserModel.php index 28f0c23..0c38d21 100644 --- a/src/Model/UserModel.php +++ b/src/Model/UserModel.php @@ -85,6 +85,11 @@ return $res[0]['id_user']; } + public function getEmailWithUser(string $user){ + $res = $this->gateway->emailWithUser($user); + return $res[0]['email']; + } + // ===================== Bool FUNCTION ===================== public function IsExisteUsername(string $username):bool{