resolution conflit

pull/25/head
kevin.modejar 3 months ago
commit 60e2f0729f

@ -12,10 +12,12 @@ $base = '';
$login = ''; $login = '';
$mdp = ''; $mdp = '';
$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website
$racine='/~lebeaulato/WF-Website'; // /~kekentin/WF/WF-Website /~lebeaulato/WF-Website /~kemondejar/WF-Website
//$racine='/WF-Website'; //$racine='/WF-Website';
//Vues //Vues
$vues['erreur'] = 'vue/erreur.php'; $vues['erreur'] = 'vue/erreur.php';
$vues['accueil'] = 'vue/accueil.php'; $vues['accueil'] = 'vue/accueil.php';

@ -15,7 +15,7 @@ if(!isset($_SESSION['theme'])){
require_once __DIR__ . '/config/config.php'; require_once __DIR__ . '/config/config.php';
require __DIR__ . '/vendor/autoload.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=wikifantasy3;', 'postgres', 'postgres');
$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); $co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd');
//twig //twig

@ -6,13 +6,13 @@
--main-dark-gradient : linear-gradient(45deg, #4a148c, #7b1fa2); --main-dark-gradient : linear-gradient(45deg, #4a148c, #7b1fa2);
--main-dark-other-color : #000000; --main-dark-other-color : #000000;
--main-light-background-color: #ffffff; --main-light-background-color: #cccccc;
/*--main-light-background-color: #ffffff;*/ /*--main-light-background-color: #ffffff;*/
--main-light-text-color : #000000; --main-light-text-color : #000;
--main-light-gradient : linear-gradient(90deg, #78b3eb, #64c1ff); --main-light-gradient : linear-gradient(90deg, #46BE73, #BAEBF6);
/*--main-light-gradient : linear-gradient(-90deg, #f3e0f7, #dd9aff);*/ /*--main-light-gradient : linear-gradient(-90deg, #f3e0f7, #dd9aff);*/
/*--main-light-gradient : linear-gradient(45deg, #73CFF6, #DE95CA);*/ /*--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 : #f8eaff;*/
/*--main-light-other-color : #d2d2d8;*/ /*--main-light-other-color : #d2d2d8;*/
} }

@ -131,6 +131,7 @@ Class VisitorControler {
{ {
$_SESSION['user'] = Verification::verifChar($pseudo); $_SESSION['user'] = Verification::verifChar($pseudo);
$_SESSION['role'] = 'user'; $_SESSION['role'] = 'user';
//$this->sendEmailLogin($pseudo,$this->uMod->getEmailWithUser($pseudo)); Envoie un email pour chaque connexion
header("Location: ". $racine); header("Location: ". $racine);
exit(); exit();
}else }else
@ -195,6 +196,7 @@ Class VisitorControler {
exit(); exit();
} }
else echo $this->uMod->insertUser($pseudo, $email, $hmdp); else echo $this->uMod->insertUser($pseudo, $email, $hmdp);
$this->sendEmailSignin($pseudo,$email);
$_SESSION["role"] = Verification::verifChar('user'); $_SESSION["role"] = Verification::verifChar('user');
$_SESSION["user"] = Verification::verifChar($pseudo); $_SESSION["user"] = Verification::verifChar($pseudo);
@ -202,4 +204,38 @@ Class VisitorControler {
header("Location: ". $racine); header("Location: ". $racine);
} }
} }
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 = "
Bonjour $pseudo,
Merci de vous être inscrit sur notre site What The Fantasy. Cest 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);
}
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);
}
} }

@ -200,5 +200,11 @@ Class UserGateway extends Gateway{
$query = 'UPDATE Users SET password=:newPassWd WHERE username=:username'; $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))); $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();
}
} }
?> ?>

@ -85,6 +85,11 @@
return $res[0]['id_user']; return $res[0]['id_user'];
} }
public function getEmailWithUser(string $user){
$res = $this->gateway->emailWithUser($user);
return $res[0]['email'];
}
// ===================== Bool FUNCTION ===================== // ===================== Bool FUNCTION =====================
public function IsExisteUsername(string $username):bool{ public function IsExisteUsername(string $username):bool{

Loading…
Cancel
Save