thchazot1 2 years ago
parent cd1b36dfd8
commit 62379a1302

@ -10,7 +10,7 @@
<div class="container"> <div class="container">
<div class="screen"> <div class="screen">
<div class="screen__content"> <div class="screen__content">
<form class="login"> <form class="login" method="POST">
<div class="login__field"> <div class="login__field">
<i class="login__icon fas fa-user"></i> <i class="login__icon fas fa-user"></i>
<input type="text" class="login__input" name="username" placeholder="Username" required> <input type="text" class="login__input" name="username" placeholder="Username" required>

@ -4,9 +4,9 @@ $rep = __DIR__ . '/../';
//$location = "Location : http://londres.uca.local/" Finir le chemin du public_html //$location = "Location : http://londres.uca.local/" Finir le chemin du public_html
$login="root"; $login="thchazot1";
$password="root"; $password="achanger";
$dsn="mysql:host=localhost;port=8888;dbname=bddDeQualite"; // chemin vers bd (mysql:host=londres.uca.local;dbname=dblibreton => pour l'iut) $dsn="mysql:host=localhost;dbname=dbthchazot1"; // chemin vers bd (mysql:host=londres.uca.local;dbname=dblibreton => pour l'iut)
$vues['erreur'] = 'Vues/erreur.php'; $vues['erreur'] = 'Vues/erreur.php';

@ -20,10 +20,10 @@ class VisitorController {
break; break;
case "signIn": case "signIn":
$this->Connection($vues_erreur); $this->Connection($dVueEreur);
break; break;
case "signUp": case "signUp":
$this->Inscription($vues_erreur); $this->Inscription($dVueEreur);
break; break;
case "accessSignIn": case "accessSignIn":
require($rep.$vues['signIn']); require($rep.$vues['signIn']);
@ -81,7 +81,9 @@ class VisitorController {
} }
$model= new MdlUser(); $model= new MdlUser();
if($model->existUser($username)){ if($model->existUser($username)){
echo $model->getPasswordHash($username);
if(password_verify($password,$model->getPasswordHash($username))){ if(password_verify($password,$model->getPasswordHash($username))){
echo "wesh";
$model->connexion($username); $model->connexion($username);
$_REQUEST['action']=null; $_REQUEST['action']=null;
$this->reinit(); $this->reinit();

@ -50,11 +50,11 @@ class UserGateway
function getHashedPassword(string $usrname):?string{ function getHashedPassword(string $usrname):?string{
$truePasswd=null; $truePasswd=null;
$query="SELECT password FROM Utilisateur WHERE name=:name"; $query="SELECT password FROM Utilisateur WHERE username=:username";
$this->con->executeQuery($query,array('name'=>array($usrname,PDO::PARAM_STR))); $this->con->executeQuery($query,array('username'=>array($usrname,PDO::PARAM_STR)));
$results=$co->getResults(); $results=$this->con->getResults();
foreach($res as $row){ foreach($results as $row){
$results=$row['pwd']; $truePasswd=$row['password'];
} }
return $truePasswd; return $truePasswd;
} }

@ -51,7 +51,8 @@ class MdlUser{
} }
public function getPasswordHash(string $usr){ public function getPasswordHash(string $usr){
return $con->getHashedPassword($usr); $gate=new UserGateway($this->con);
return $gate->getHashedPassword($usr);
} }
} }

Loading…
Cancel
Save