diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 17f7a7f..f86a8f2 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -51,7 +51,7 @@ public function add() $user = [ 'firstname' => ucfirst($_POST['firstname']), 'lastname' => strtoupper($_POST['lastname']), - 'password' => password_hash($_POST['password'], PASSWORD_BCRYPT), + 'password' => $_POST['password'], 'mail' => strtolower($_POST['mail']), 'tel' => $_POST['tel'], ]; @@ -99,7 +99,7 @@ public function update(int $id) et contenir au moins une majuscule et un chiffre"; return $this->twig->render('User/update.html.twig', ['user' => $user, 'message' => $message]); } else { - $user['password'] = password_hash($_POST['password'], PASSWORD_BCRYPT); + $user['password'] =$_POST['password']; $userManager->update($user); $user = $userManager->selectOneById($id); $cartid = $cartManager->historiqueID($id); @@ -175,6 +175,35 @@ public function show(int $id) } } + public function showAd($id) + { + if ($_SESSION["role"] == "admin") { + $userManager = new UserManager(); + $cartManager = new CartManager(); + + $user = $userManager->selectOneById($id); + $cartid = $cartManager->historiqueID($id); + if ($cartid) { + $cartid = $cartid['id']; + $cart = $cartManager->showCartContent($cartid); + $concepts = $cartManager->conceptInCart($cartid); + $recap = $cartManager->showPriceCart($cartid); + return $this->twig->render('User/showAdmin.html.twig', [ + 'user' => $user, + "cart" => $cart, + "concepts"=>$concepts, + "recap"=>$recap, + ]); + } else { + return $this->twig->render('User/showAdmin.html.twig', [ + 'user' => $user, + ]); + } + } else { + header('location:/Account/login/'); + } + } + /** * @param int $id */ diff --git a/src/View/User/index.html.twig b/src/View/User/index.html.twig index 34650b9..1934f64 100644 --- a/src/View/User/index.html.twig +++ b/src/View/User/index.html.twig @@ -17,8 +17,7 @@
DATE | +PRIX | +
---|---|
{{ recap.date }} | +{{ recap.prix_total }} | +
CONTENU | +|
{{ item.quantite }} * {{ item.nom }} | +|
Bouquet personnalisé | +|
1 | ++ {{ concept.produit }} + | +