Ajout erreur404 & 403, modif regex mdp, lien user de preview fixed

This commit is contained in:
laura.chevillet 2026-02-17 15:56:56 +01:00
parent 46bc4952dc
commit a0738bb737
11 changed files with 52 additions and 10 deletions

View file

@ -25,7 +25,6 @@
header("Location:index.php?ctrl=error&action=error_403");
exit;
}
var_dump($_SESSION);
//gestion de l'user
$objCategoryModel = new CategoryModel;
@ -44,6 +43,7 @@
$editCat->setId($_POST['id_to_edit']);
$editCat->setName($_POST['new_name']);
$objCategoryModel->editCategory($editCat);
$_SESSION['success'] = "La catégorie a bien été modifiée";
header('Location: index.php?ctrl=admin&action=admin');
exit;
}

View 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");
}
}

View file

@ -110,7 +110,7 @@ class UserCtrl extends MotherCtrl {
$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() == ""){
$arrError['user_password'] = "Le mot de passe est obligatoire";
}else if (!preg_match($strRegex, $objUser->getPwd())){