Ajout erreur404 & 403, modif regex mdp, lien user de preview fixed
This commit is contained in:
parent
46bc4952dc
commit
a0738bb737
11 changed files with 52 additions and 10 deletions
BIN
assests/img/error403.jpg
Normal file
BIN
assests/img/error403.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
BIN
assests/img/error404.webp
Normal file
BIN
assests/img/error404.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
|
|
@ -25,7 +25,6 @@
|
||||||
header("Location:index.php?ctrl=error&action=error_403");
|
header("Location:index.php?ctrl=error&action=error_403");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
var_dump($_SESSION);
|
|
||||||
|
|
||||||
//gestion de l'user
|
//gestion de l'user
|
||||||
$objCategoryModel = new CategoryModel;
|
$objCategoryModel = new CategoryModel;
|
||||||
|
|
@ -44,6 +43,7 @@
|
||||||
$editCat->setId($_POST['id_to_edit']);
|
$editCat->setId($_POST['id_to_edit']);
|
||||||
$editCat->setName($_POST['new_name']);
|
$editCat->setName($_POST['new_name']);
|
||||||
$objCategoryModel->editCategory($editCat);
|
$objCategoryModel->editCategory($editCat);
|
||||||
|
$_SESSION['success'] = "La catégorie a bien été modifiée";
|
||||||
header('Location: index.php?ctrl=admin&action=admin');
|
header('Location: index.php?ctrl=admin&action=admin');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
24
controllers/error_controller.php
Normal file
24
controllers/error_controller.php
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
require("mother_controller.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Le contrôleur des erreurs
|
||||||
|
* @author Laura (largement inspiré de Christel)
|
||||||
|
*/
|
||||||
|
class ErrorCtrl extends MotherCtrl{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page erreur 404
|
||||||
|
*/
|
||||||
|
public function error_404(){
|
||||||
|
$this->_display("error_404");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page erreur 403
|
||||||
|
*/
|
||||||
|
public function error_403(){
|
||||||
|
$this->_display("error_403");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -110,7 +110,7 @@ class UserCtrl extends MotherCtrl {
|
||||||
$arrError['user_pseudo'] = "Le pseudo est obligatoire";
|
$arrError['user_pseudo'] = "Le pseudo est obligatoire";
|
||||||
}
|
}
|
||||||
|
|
||||||
$strRegex = "/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{16,}$/";
|
$strRegex = "/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{15,}$/";
|
||||||
if ($objUser->getPwd() == ""){
|
if ($objUser->getPwd() == ""){
|
||||||
$arrError['user_password'] = "Le mot de passe est obligatoire";
|
$arrError['user_password'] = "Le mot de passe est obligatoire";
|
||||||
}else if (!preg_match($strRegex, $objUser->getPwd())){
|
}else if (!preg_match($strRegex, $objUser->getPwd())){
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if($boolError){
|
if($boolError){
|
||||||
echo "error 404 - la page elle existe pas ";
|
header("Location:index.php?ctrl=error&action=error_404");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,5 +84,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
{$success_message|vardump}
|
|
||||||
{include file="views/_partial/messages.tpl"}
|
{include file="views/_partial/messages.tpl"}
|
||||||
|
|
@ -3,21 +3,24 @@
|
||||||
|
|
||||||
{* IMAGE (partie supérieure - plus grande) *}
|
{* IMAGE (partie supérieure - plus grande) *}
|
||||||
<div class="ratio ratio-4x3">
|
<div class="ratio ratio-4x3">
|
||||||
|
<a href="index.php?ctrl=project&action=display&id={$objProject->getId()}"></a>
|
||||||
<img src=".{$objProject->getThumbnail()}"
|
<img src=".{$objProject->getThumbnail()}"
|
||||||
class="w-100 h-100 object-fit-cover"
|
class="w-100 h-100 object-fit-cover"
|
||||||
alt=""
|
alt=""
|
||||||
loading="lazy">
|
loading="lazy">
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{* CONTENU (photo profil + infos) *}
|
{* CONTENU (photo profil + infos) *}
|
||||||
<div class="card-body p-3 bg-light">
|
<div class="card-body p-3 bg-light">
|
||||||
<div class="d-flex align-items-start gap-3">
|
<div class="d-flex align-items-start gap-3">
|
||||||
{* PHOTO DE PROFIL (cercle à gauche - plus grand) *}
|
{* PHOTO DE PROFIL (cercle à gauche - plus grand) *}
|
||||||
|
<a href="index.php?ctrl=user&action=user&id={$objProject->getUser_id()}">
|
||||||
<img src="{$objProject->getUser_image()}"
|
<img src="{$objProject->getUser_image()}"
|
||||||
class="rounded-circle flex-shrink-0 border border-2 border-white"
|
class="rounded-circle flex-shrink-0 border border-2 border-white"
|
||||||
style="width: 64px; height: 64px; object-fit: cover; margin-top: 8px;"
|
style="width: 64px; height: 64px; object-fit: cover; margin-top: 8px;"
|
||||||
alt="Photo de profil">
|
alt="Photo de profil">
|
||||||
|
</a>
|
||||||
{* INFOS À DROITE *}
|
{* INFOS À DROITE *}
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1">
|
||||||
<h3 class="h6 fw-bold mb-2 mt-1">{$objProject->getTitle()}</h3>
|
<h3 class="h6 fw-bold mb-2 mt-1">{$objProject->getTitle()}</h3>
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,6 @@
|
||||||
<h2>Gestion de l'utilsateur</h2>
|
<h2>Gestion de l'utilsateur</h2>
|
||||||
<p>Changer le statut ou supprimer un utilisateur</p>
|
<p>Changer le statut ou supprimer un utilisateur</p>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-2">
|
|
||||||
<img src="./assests/img/Logo-Wordmark.svg" alt="" width="100">
|
|
||||||
</div>
|
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<select class="form-select" aria-label="Default select example" name="user_id">
|
<select class="form-select" aria-label="Default select example" name="user_id">
|
||||||
|
|
@ -24,6 +21,7 @@
|
||||||
<option value="{$user->getId()}">{$user->getName()} {$user->getFirstname()}</option>
|
<option value="{$user->getId()}">{$user->getName()} {$user->getFirstname()}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
|
<br>
|
||||||
<select class="form-select" aria-label="Default select example" name="new_status">
|
<select class="form-select" aria-label="Default select example" name="new_status">
|
||||||
<option value="0" selected>Modifier le statut de l'Utilisateur...</option>
|
<option value="0" selected>Modifier le statut de l'Utilisateur...</option>
|
||||||
{foreach from=$arrAuthorisationToDisplay item=arrDetAuthorisation}
|
{foreach from=$arrAuthorisationToDisplay item=arrDetAuthorisation}
|
||||||
|
|
@ -31,6 +29,7 @@
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<br>
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<button type="submit" name="action" value="update_status" class="btn bg-success text-light"> Valider</button>
|
<button type="submit" name="action" value="update_status" class="btn bg-success text-light"> Valider</button>
|
||||||
<button type="submit" name="action" value="delete_user" class="btn bg-danger text-light" onclick="return confirm('Attention ! Êtes-vous sûr de vouloir supprimer cet utilisateur ? Cette action est irréversible.');">Supprimer l'utilisateur</button>
|
<button type="submit" name="action" value="delete_user" class="btn bg-danger text-light" onclick="return confirm('Attention ! Êtes-vous sûr de vouloir supprimer cet utilisateur ? Cette action est irréversible.');">Supprimer l'utilisateur</button>
|
||||||
|
|
@ -63,7 +62,6 @@
|
||||||
<div>
|
<div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- creation cat-->
|
<!-- creation cat-->
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
|
|
|
||||||
9
views/error_403.tpl
Normal file
9
views/error_403.tpl
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{extends file="views/layout.tpl"}
|
||||||
|
|
||||||
|
{block name="content"}
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-1">Erreur 403</h1>
|
||||||
|
<h2 class="display-3">Vous n'êtes pas autorisé à accéder à cette page !</h2>
|
||||||
|
<img class="img-fluid" src="assests/img/error403.jpg">
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
9
views/error_404.tpl
Normal file
9
views/error_404.tpl
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{extends file="views/layout.tpl"}
|
||||||
|
|
||||||
|
{block name="content"}
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-1">Erreur 404</h1>
|
||||||
|
<h2 class="display-3">Cette page n'existe pas !</h2>
|
||||||
|
<img class="img-fluid" src="assests/img/error404.webp">
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue