diff --git a/assets/bin.png b/assets/bin.png new file mode 100644 index 0000000..bc4a00f Binary files /dev/null and b/assets/bin.png differ diff --git a/assets/done.png b/assets/done.png new file mode 100644 index 0000000..0146337 Binary files /dev/null and b/assets/done.png differ diff --git a/assets/checklist.png b/assets/logo.png similarity index 100% rename from assets/checklist.png rename to assets/logo.png diff --git a/assets/to-do.png b/assets/to-do.png new file mode 100644 index 0000000..1793eb5 Binary files /dev/null and b/assets/to-do.png differ diff --git a/config/Autoload.php b/config/Autoload.php index 6e2b533..b1ddb59 100644 --- a/config/Autoload.php +++ b/config/Autoload.php @@ -40,7 +40,7 @@ class Autoload $filename = $class.'.php'; $dir = array('./','config/','controleurs/','modeles/Gateways/','modeles/Métier/','modeles/Modele/'); foreach ($dir as $d){ - $file=$rep.$d.$filename; + $file=$rep.$d.$filename; if (file_exists($file)) { include $file; diff --git a/config/Validation.php b/config/Validation.php index 5b9685f..1640f47 100644 --- a/config/Validation.php +++ b/config/Validation.php @@ -3,57 +3,47 @@ class Validation { static function val_connexion($usrName,$mdp,$dataVueEreur) { if (!isset($usrName)||$usrName=="") { - $dataVueEreur[] ="Nom d'utilisateur manquant"; - throw new Exception('pas de username'); + $dataVueEreur[] ="Username or password missing"; } $usrName = Validation::clear_string($usrName); if($usrName == false){ $dataVueEreur[] = "Sanitizing error"; - throw new Exception('sanitizing fail'); } if (!isset($mdp)||$mdp=="") { - $dataVueEreur[] ="Mot de passe manquant"; - throw new Exception('pas de password'); + $dataVueEreur[] ="Username or password missing"; } $mdp = Validation::clear_string($mdp); if($mdp == false){ $dataVueEreur[] = "Sanitizing error"; - throw new Exception('sanitizing fail'); } return $dataVueEreur; } - static function val_inscription($dataVueEreur){ - if (!isset($_POST['username'])||$_POST['username']==="") { - $dataVueEreur[] ="Nom d'utilisateur manquant"; - throw new Exception('pas de username'); + static function val_inscription($username,$pwd1,$pwd2,$dataVueEreur){ + if (!isset($username)||$username==="") { + $dataVueEreur[] ="All fields are required"; } $_POST['username'] = Validation::clear_string($_POST['username']); if($_POST['username'] == false){ $dataVueEreur[] = "Sanitizing error"; throw new Exception('sanitizing fail'); } - if (!isset($_POST['username'])||$_POST['username']==="") { - $dataVueEreur[] ="Mot de passe manquant"; - throw new Exception('pas de password'); + if (!isset($pwd1)||$pwd1==="") { + $dataVueEreur[] ="All fields are required"; } $_POST['password'] = Validation::clear_string($_POST['password']); if($_POST['password'] == false){ $dataVueEreur[] = "Sanitizing error"; - throw new Exception('sanitizing fail'); } - if (!isset($_POST['confirmpassword'])||$_POST['confirmpassword']==="") { - $dataVueEreur[] ="Confirmation mot de passe manquant"; - throw new Exception('pas de confirmation password'); + if (!isset($pwd2)||$pwd2==="") { + $dataVueEreur[] ="All fields are required"; } $_POST['confirmpassword'] = Validation::clear_string($_POST['confirmpassword']); if($_POST['confirmpassword'] == false){ $dataVueEreur[] = "Sanitizing error"; - throw new Exception('sanitizing fail'); } - if($_POST['password'] !== $_POST['confirmpassword']){ - $dataVueEreur[]="Mot de passe et confirmation différents"; - throw new Exception("Mot de passe et confirmation différents"); + if($pwd1 !== $pwd2){ + $dataVueEreur[]="Invalid confirmation"; } return $dataVueEreur; } diff --git a/config/config.php b/config/config.php index 93d6107..f6edb98 100644 --- a/config/config.php +++ b/config/config.php @@ -3,7 +3,7 @@ //Prefixe $rep=__DIR__.'/../'; //BD -$bd['dsn'] = "mysql:host=localhost;port=8888;dbname=bdPhp"; +$bd['dsn'] = "mysql:host=localhost;port=8888;dbname=dbPhp"; $bd['user'] = "root"; $bd['pswd'] = "root"; //Vues @@ -16,11 +16,14 @@ $vues['listesPrivees']='vues/listesPrivees.php'; $vues['creationListe']='vues/creationListe.php'; $vues['infosListe']='vues/infosListe.php'; $vues['creationTache']='vues/creationTache.php'; + // Styles $styles['commun']='styles/commonStyles.css'; -$styles['connection']='styles/connectionStyle.css'; +$styles['acceuil']='styles/acceuilStyles.css'; +$styles['connection']='styles/connectionStyles.css'; +$styles['listesPv']="styles/privateListsStyles.css"; // Assets -$assets['logo']='assets/chekliste.png'; +$assets['logo']='assets/logo.png'; ?> \ No newline at end of file diff --git a/controleurs/ControleurUtilisateur.php b/controleurs/ControleurUtilisateur.php index fa4e665..2a7ae48 100644 --- a/controleurs/ControleurUtilisateur.php +++ b/controleurs/ControleurUtilisateur.php @@ -6,38 +6,21 @@ class ControleurUtilisateur{ global $rep,$vues, $dataView,$styles,$assets; $arrayErrorViews= array(); - $action = $_REQUEST['action']??null; + $action = $_REQUEST['action']; switch($action){ case "accessPrivateLists": $this->accessPrivateLists($arrayErrorViews); - case "accessProfilePage": - require($rep.$vues['profile']); - break; - case "deconnection": - $this->deconnection($arrayErrorViews); - break; + case "creerListePv": $this->creerListe($arrayErrorViews); break; - case "desinscription": - $this->desinctription($arrayErrorViews); - break; - case "changerInfos": - $this->changerPassword($arrayErrorViews); - break; - default : + default: $arrayErrorViews[]="Erreur innatendue !!!"; require($rep.$vues['error']); } } - function deconnection($arrayErrorViews){ - global $rep, $vues, $dataView; - $model = new UserModel(); - $retour = $model->deconnection(); - $_REQUEST['action']=null; - $control= new ControleurVisiteur(); - } + function creerListePv($arrayErrorViews){ global $rep, $vues, $dataView; @@ -67,21 +50,6 @@ class ControleurUtilisateur{ } } - function changerPassword($arrayErrorViews){ - global $rep, $vues, $dataView; - $password1=$_POST['password1']; - $passwordConfirm=$_POST['passwordConfirm']; - $newPassword=Validation::val_changer_password($password1,$passwordConfirm); - - try{ - UserModel::changerPassword($newPassword); - require($rep.$vues['profil']); - }catch(PDOException $e){ - $dataView[]="Erreur inatendue"; - require($rep.$vues['erreur']); - } - } - function accessPrivateLists($arrayErrorViews){ global $rep, $vues, $dataView; $model = new UserModel(); diff --git a/controleurs/ControleurVisiteur.php b/controleurs/ControleurVisiteur.php index dbd9467..3d9df18 100644 --- a/controleurs/ControleurVisiteur.php +++ b/controleurs/ControleurVisiteur.php @@ -50,6 +50,9 @@ class ControleurVisiteur { case "delListe": $this->delListe($arrayErrorViews); break; + case "deconnection": + $this->deconnection($arrayErrorViews); + break; default : $arrayErrorViews[]="Erreur innatendue !!!"; require($rep.$vues['acceuil']); @@ -61,6 +64,15 @@ class ControleurVisiteur { exit(0); } + + function deconnection($arrayErrorViews){ + global $rep, $vues, $dataView; + $model = new UserModel(); + $retour = $model->deconnection(); + $_REQUEST['action']=null; + $control= new ControleurVisiteur(); + } + public function reinit(){ global $rep,$vues,$dataView,$styles; $model = new VisiteurModel(); @@ -111,6 +123,9 @@ class ControleurVisiteur { $usrname=$_POST['login']; $pwd=$_POST['mdp']; $vues_erreur=Validation::val_connexion($usrname,$pwd,$vues_erreur); + if(!empty($vues_erreur)){ + require($rep.$vues['connection']); + } $model= new VisiteurModel(); if($model->existUser($usrname)){ if(password_verify($pwd,$model->getHashedPassword($usrname))){ @@ -119,26 +134,34 @@ class ControleurVisiteur { $this->reinit(); } else{ - echo 'mauvais passwd verify'; - $arrayErrorViews =array('username'=>$usrname,'password'=>$pwd); - require($rep.$vues['erreur']); + $vues_erreur =array('username'=>$usrname,'password'=>$pwd); + require($rep.$vues['connection']); } } else{ - echo 'mauvais user'; - $arrayErrorViews =array('username'=>$usrname,'password'=>$pwd); - require($rep.$vues['erreur']); + $vues_erreur =array('username'=>$usrname,'password'=>$pwd); + require($rep.$vues['connection']); } } public function inscription(array $vues_erreur){ global $rep,$vues,$dataView; - $vues_erreur=Validation::val_inscription($vues_erreur); - if($vues_erreur == []){ + $usrname=$_POST['username']; + $pwd=$_POST['password']; + $confirm=$_POST['confirmpassword']; + $model = new VisiteurModel(); + $vues_erreur=Validation::val_inscription($usrname,$pwd,$confirm,$vues_erreur); + if($model->existUser($usrname)){ + $vues_erreur[]="Username already taken"; + } + if(empty($vues_erreur)){ $hash= password_hash($pwd,PASSWORD_DEFAULT); - $model = new VisiteurModel(); - $model->inscription($_POST['username'],$hash); + $model->inscription($usrname,$hash); + } + else{ + require($rep.$vues['inscription']); } + $_REQUEST['action']=null; new ControleurVisiteur(); } diff --git a/controleurs/FrontControleur.php b/controleurs/FrontControleur.php index d03e037..57facd0 100644 --- a/controleurs/FrontControleur.php +++ b/controleurs/FrontControleur.php @@ -3,13 +3,13 @@ class FrontControleur{ public function __construct(){ - $liste_actions_utilisateur = array('accessPrivateLists','accessProfilePage','deconnection','crerListePv','desinscription','changerPassword'); - $liste_actions_visiteur = array('goHome','changeCompletedTache','accessCreationTachePage','addTache','delTache','accessListInfos','accessCreationListePage','accessInscription','accessConnectionPage','creerListe','delListe','connection','inscription'); + $liste_actions_utilisateur = array('accessPrivateLists','crerListePv'); + $liste_actions_visiteur = array('goHome','changeCompletedTache','accessCreationTachePage','addTache','delTache','accessListInfos','accessCreationListePage','accessInscription','accessConnectionPage','creerListe','delListe','connection','inscription','deconnection'); global $rep,$vues,$bd,$dataView,$styles,$assets; session_start(); try{ $user=$_SESSION??null; - $action = !empty($_REQUEST['action']) ? (string)$_REQUEST['action']:null; + $action = $_REQUEST['action']; if (in_array($action,$liste_actions_utilisateur)){ if($user == null){ diff --git a/index.php b/index.php index 780d010..c92edb4 100644 --- a/index.php +++ b/index.php @@ -8,23 +8,6 @@ require_once(__DIR__.'/config/config.php'); require_once(__DIR__.'/config/Autoload.php'); Autoload::charger(); -/* -require_once(__DIR__.'/config/Validation.php'); -require_once(__DIR__.'/controleurs/ControleurUtilisateur.php'); -require_once(__DIR__.'/controleurs/ControleurVisiteur.php'); -require_once(__DIR__.'/controleurs/FrontControleur.php'); -require_once(__DIR__.'/modeles/Gateways/Connection.php'); -require_once(__DIR__.'/modeles/Gateways/ListeGateway.php'); -require_once(__DIR__.'/modeles/Gateways/UserGateway.php'); -require_once(__DIR__.'/modeles/Métier/Liste.php'); -require_once(__DIR__.'/modeles/Métier/Tache.php'); -require_once(__DIR__.'/modeles/Métier/Utilisateur.php'); -require_once(__DIR__.'/modeles/Modele/UserModel.php'); -require_once(__DIR__.'/modeles/Modele/VisiteurModel.php'); -require_once(__DIR__.'/modeles/Modele/ListModel.php'); -*/ - - // Construction du controleur //$cont=new FrontControleur(); $cont= new FrontControleur(); diff --git a/modeles/Métier/Liste.php b/modeles/Métier/Liste.php index f731528..9d7dd68 100644 --- a/modeles/Métier/Liste.php +++ b/modeles/Métier/Liste.php @@ -1,10 +1,10 @@ id=$i; @@ -12,6 +12,22 @@ class Liste { $this->nomCreateur=$nomCrea; $this->taches=$t; } + + public function get_id():int{ + return $this->id; + } + + public function get_nom():string{ + return $this->nom; + } + + public function get_nomCreateur():string{ + return $this->nomCreateur; + } + + public function get_taches():?array{ + return $this->taches; + } } ?> \ No newline at end of file diff --git a/modeles/Métier/Tache.php b/modeles/Métier/Tache.php index 123f746..50351f6 100644 --- a/modeles/Métier/Tache.php +++ b/modeles/Métier/Tache.php @@ -1,17 +1,33 @@ id = $i; $this->nom = $in; $this->isCompleted = $is; $this->idListe=$idListe; } + + public function get_id():int{ + return $this->id; + } + + public function get_nom():string{ + return $this->nom; + } + + public function get_isCompleted():bool{ + return $this->isCompleted; + } + + public function get_idListe():int{ + return $this->idListe; + } } ?> \ No newline at end of file diff --git a/modeles/Métier/Utilisateur.php b/modeles/Métier/Utilisateur.php index 7c3297e..8a3a471 100644 --- a/modeles/Métier/Utilisateur.php +++ b/modeles/Métier/Utilisateur.php @@ -10,9 +10,7 @@ Class Utilisateur { $this->password=$p; $this->listListe=$liste; } - function get_id(): int { - return $this->id; - } + function get_nom(): string { return $this->nom; } diff --git a/styles/acceuilStyles.css b/styles/acceuilStyles.css new file mode 100644 index 0000000..4d5b306 --- /dev/null +++ b/styles/acceuilStyles.css @@ -0,0 +1,69 @@ +.head-body{ + display:flex; + flex-direction: row; + height: 100px; + margin-bottom: 50px; + place-content: end space-between; + align-items: center; +} + +.connection{ + width: 125px; + padding: 15%; + background: none; + font-family: sans-serif; + font-size: 20; + color: #212F3D; + border: solid 2px; + border-radius: 10px; + border-color: #212F3D; +} + +.deconnection{ + width: 125px; + padding: 15%; + border: none; + color:#B2BABB; + background-color: #212F3D; + font-family: sans-serif; + border-radius: 10px; +} + +#accessList{ + color: #212F3D; + background-color: #E4F8FF; + margin: 2%; + padding: 3%; + border-radius: 30px; + display: flex; + place-content: end space-between; +} + +.private-lists{ + background: none; + border:none; + color: #212F3D; + background-color: #F7F9F9; + font-family: sans-serif; + font-size: 25; + padding : 40px; + border-radius: 25px; +} + +.create-list{ + margin-top: 2%; + background: none; + border:none; + color: #212F3D; + background-color: #F7F9F9; + font-family: sans-serif; + font-size: 25; + padding : 40px; + border-radius: 50px; + margin-left: 25%; + width: 50%; +} + +.private-lists:hover{ + background-color: #E4F8FF; +} \ No newline at end of file diff --git a/styles/commonStyles.css b/styles/commonStyles.css index 2a24d51..681577a 100644 --- a/styles/commonStyles.css +++ b/styles/commonStyles.css @@ -1,26 +1,80 @@ header{ + padding-top: 2%; + padding-bottom: 2%; + height: 5%; + width: 100%; + background:none; display: flex; - flex-direction: row; - background-color: #0971C9; + justify-content: center; + align-items: center; + vertical-align: middle; + place-content: start space-evenly; } body{ - background-color: #0D2350; + display: flex; + flex-direction: column; + align-items: center; + align-content: center; +} +h1{ + font-family: sans-serif; + font-size: 30; +} +h2{ + margin-top: 35px; + font-family: sans-serif; + font-size: 25; + color: #E4F8FF; +} +.body{ + animation: changeColor 5s infinite alternate linear; + width: 81%; + padding-left: 10%; + padding-right: 10%; + padding-bottom: 10%; + padding-top: 5%; + display: flex; + flex-direction: column; } -h1, h2, h3, h4, p{ + +@keyframes changeColor{ + 0% { + background-color: #004D67; + } + 25% { + background: #005F80; + } + 50%{ + background: #007198; + } + 75%{ + background: #0081AD; + } + 100%{ + background: #0089B8; + } +} + + +h4{ + margin-left: 5%; + align-self: center; + font-size: 20; font-family: sans-serif; - font-weight: bolder; - color: #FFFEFD; + color: #212F3D; } + .button{ - width: 50%; - height: 100%; - background-color: #FFFEFD; - border-radius: 20%; - border-color: #0971C9; - color: #0D2350; - -} -.button:hover{ - background-color: grey; + border: none; + color:#B2BABB; + background-color: #212F3D; + font-family: sans-serif; + padding:30px; + border-radius: 20px; +} + +#GoHome > input[type="image"] { + height: 50px; + width: 50px; } \ No newline at end of file diff --git a/styles/connectionStyles.css b/styles/connectionStyles.css new file mode 100644 index 0000000..98a66eb --- /dev/null +++ b/styles/connectionStyles.css @@ -0,0 +1,66 @@ +.body{ + align-items: center; +} + +header{ + place-content: start center; +} + +h1{ + margin-left: 5%; +} + +#error{ + margin-top: 5%; + margin-bottom: -5%; + margin-left: 29%; +} + +#connectionForm{ + background-color: #E4F8FF; + width: 50%; + padding: 5%; + border-radius: 50px; + place-content: start center; +} + +#connectionForm > input[type="text"]{ + width: 60%; + height: 40px; + margin-left: 20%; + border-radius: 10px; + border: 1px solid #212F3D; + margin-bottom: 3%; +} + +#connectionForm > input[type="password"]{ + width: 60%; + height: 40px; + margin-left: 20%; + border-radius: 10px; + border: 1px solid #212F3D; + margin-bottom: 3%; +} + +.button{ + border-radius: 50px; + width: 50%; + margin-left: 25%; + margin-top: 10%; +} + +.accesInscription{ + margin-top: 2%; + background: none; + border:none; + color: #212F3D; + background-color: #F7F9F9; + font-family: sans-serif; + font-size: 25; + padding-left : 100px; + padding-right : 100px; + padding-top:30px; + padding-bottom:30px; + border-radius: 50px; + width: 100%; +} diff --git a/styles/creationStyles.css b/styles/creationStyles.css new file mode 100644 index 0000000..adb8683 --- /dev/null +++ b/styles/creationStyles.css @@ -0,0 +1,46 @@ +header{ + place-content: start center; +} + +h1{ + margin-left: 5%; +} + +.body{ + align-items: center; +} + +#creationForm{ + background-color: #E4F8FF; + width: 50%; + padding: 5%; + border-radius: 50px; + place-content: start center; + } + +#creationForm > input[type="text"]{ + width: 60%; + height: 40px; + margin-left: 20%; + border-radius: 10px; + border: 1px solid #212F3D; + margin-bottom: 3%; +} + +label{ + font-family: sans-serif; + font-weight: bold; + font-size: 20; + color: #212F3D; +} + +p{ + margin-left: 5%; +} + +.button{ + border-radius: 50px; + width: 50%; + margin-left: 25%; + margin-top: 10%; +} \ No newline at end of file diff --git a/styles/detailsListStyles.css b/styles/detailsListStyles.css new file mode 100644 index 0000000..aee1788 --- /dev/null +++ b/styles/detailsListStyles.css @@ -0,0 +1,61 @@ +header{ + place-content: start center; +} + +h1{ + margin-left: 5%; +} + +#delTache > input[type='image']{ + height: 50px; + width: 50px; +} + +#check > input[type='image']{ + height: 50px; + width: 50px; +} + +#uncheck > input[type='image']{ + height: 50px; + width: 50px; +} + +.tache{ + color: #212F3D; + background-color: #E4F8FF; + margin: 2%; + padding: 3%; + border-radius: 30px; + display: flex; + place-content: end space-between; +} + +.add-task{ + margin-top: 2%; + background: none; + border:none; + color: #212F3D; + background-color: #F7F9F9; + font-family: sans-serif; + font-size: 25; + padding : 40px; + border-radius: 50px; + margin-left: 25%; + width: 50%; +} + +.del-list{ + margin-top: 2%; + background: none; + border:none; + color: #212F3D; + background-color: #F7F9F9; + font-family: sans-serif; + font-size: 25; + padding : 25px; + border-radius: 50px; + margin-left: 35%; + width: 30%; +} + diff --git a/styles/privateListsStyles.css b/styles/privateListsStyles.css new file mode 100644 index 0000000..6960bc8 --- /dev/null +++ b/styles/privateListsStyles.css @@ -0,0 +1,8 @@ +header{ + place-content: start center; +} + +h1{ + margin-left: 5%; +} + diff --git a/vues/acceuil.php b/vues/acceuil.php index 47d1592..1999153 100644 --- a/vues/acceuil.php +++ b/vues/acceuil.php @@ -3,64 +3,70 @@