ajouter affichage erreur inscription

This commit is contained in:
Yasder5 2026-02-11 18:21:19 +01:00
parent 9d3ff72100
commit 7ea2d1add5
9 changed files with 81 additions and 35 deletions

View file

@ -127,7 +127,6 @@ class UserCtrl extends MotherCtrl {
// Si pas d'erreurs => insertion // Si pas d'erreurs => insertion
if (count($arrError) === 0) { if (count($arrError) === 0) {
$objUserModel = new UserModel(); $objUserModel = new UserModel();
$boolInsert = $objUserModel->insert($objUser);
if ($objUserModel->mailExists($objUser->getMail())) { if ($objUserModel->mailExists($objUser->getMail())) {
@ -147,6 +146,7 @@ class UserCtrl extends MotherCtrl {
} }
// Affichage de la vue inscription // Affichage de la vue inscription
var_dump($arrError);
$this->_arrData["arrError"] = $arrError; $this->_arrData["arrError"] = $arrError;
$this->_display("inscription"); $this->_display("inscription");
} }

View file

@ -1,18 +1,18 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-11 16:40:19 /* Smarty version 5.7.0, created on 2026-02-11 17:20:34
from 'file:views/inscription.tpl' */ from 'file:views/inscription.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_698cb0f3a8c260_72571411', 'unifunc' => 'content_698cba62a72df8_61715147',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
'184f81453f2b8e9c87b8f61bf5df178eaf9a1be4' => '184f81453f2b8e9c87b8f61bf5df178eaf9a1be4' =>
array ( array (
0 => 'views/inscription.tpl', 0 => 'views/inscription.tpl',
1 => 1770649781, 1 => 1770830431,
2 => 'file', 2 => 'file',
), ),
), ),
@ -20,18 +20,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array ( array (
), ),
))) { ))) {
function content_698cb0f3a8c260_72571411 (\Smarty\Template $_smarty_tpl) { function content_698cba62a72df8_61715147 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views'; $_smarty_current_dir = 'D:\\projetphp\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true); $_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?> ?>
<?php <?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_268185928698cb0f3a8a4d2_62245512', "content"); $_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1012653795698cba62a6b7c0_71138616', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir); $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
} }
/* {block "content"} */ /* {block "content"} */
class Block_268185928698cb0f3a8a4d2_62245512 extends \Smarty\Runtime\Block class Block_1012653795698cba62a6b7c0_71138616 extends \Smarty\Runtime\Block
{ {
public function callBlock(\Smarty\Template $_smarty_tpl) { public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views'; $_smarty_current_dir = 'D:\\projetphp\\views';
@ -43,7 +43,7 @@ $_smarty_current_dir = 'D:\\projetphp\\views';
<main class="container py-5"> <main class="container py-5">
<!-- Centrage horizontal du formulaire --> <!-- Centrage horizontal du formulaire -->
<div class="row justify-content-center"> <div class="row justify-content-center position-relative">
<div class="col-12 col-md-10 col-lg-6"> <div class="col-12 col-md-10 col-lg-6">
<!-- Carte contenant le formulaire d'inscription --> <!-- Carte contenant le formulaire d'inscription -->
@ -56,7 +56,21 @@ $_smarty_current_dir = 'D:\\projetphp\\views';
<p class="text-secondary mb-4"> <p class="text-secondary mb-4">
Créez votre compte utilisateur. Créez votre compte utilisateur.
</p> </p>
<?php if (((true && ($_smarty_tpl->hasVariable('arrError') && null !== ($_smarty_tpl->getValue('arrError') ?? null))) && $_smarty_tpl->getSmarty()->getModifierCallback('count')($_smarty_tpl->getValue('arrError')) > 0)) {?>
<div class="alert alert-danger">
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrError'), 'strError');
$foreach0DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('strError')->value) {
$foreach0DoElse = false;
?>
<p><?php echo $_smarty_tpl->getValue('strError');?>
</p>
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</div>
<?php }?>
<!-- Formulaire d'inscription --> <!-- Formulaire d'inscription -->
<!-- Les données seront traitées côté serveur en PHP via la méthode POST --> <!-- Les données seront traitées côté serveur en PHP via la méthode POST -->
<form method="POST"> <form method="POST">
@ -134,6 +148,19 @@ $_smarty_current_dir = 'D:\\projetphp\\views';
required required
> >
</div> </div>
<!-- Champ : confirmer le mot de passe -->
<div class="col-12">
<label class="form-label" for="pwd_confirm">
Confirmer le Mot de passe *
</label>
<input
class="form-control"
type="password"
id="pwd_confirm"
name="pwd_confirm"
required
>
</div>
<!-- Champ optionnel : numéro de téléphone --> <!-- Champ optionnel : numéro de téléphone -->
<div class="col-12"> <div class="col-12">

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-11 16:54:33 /* Smarty version 5.7.0, created on 2026-02-11 17:20:34
from 'file:views/layout.tpl' */ from 'file:views/layout.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_698cb4496b9cb3_04936871', 'unifunc' => 'content_698cba62b4e137_64473486',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -22,21 +22,21 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'file:views/_partial/footer.tpl' => 1, 'file:views/_partial/footer.tpl' => 1,
), ),
))) { ))) {
function content_698cb4496b9cb3_04936871 (\Smarty\Template $_smarty_tpl) { function content_698cba62b4e137_64473486 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views'; $_smarty_current_dir = 'D:\\projetphp\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, false); $_smarty_tpl->getInheritance()->init($_smarty_tpl, false);
$_smarty_tpl->renderSubTemplate("file:views/_partial/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir); $_smarty_tpl->renderSubTemplate("file:views/_partial/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
?> ?>
<?php <?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_382193566698cb4496b8402_05526599', "content"); $_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1102964570698cba62b4c8c6_53649331', "content");
?> ?>
<?php $_smarty_tpl->renderSubTemplate("file:views/_partial/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir); <?php $_smarty_tpl->renderSubTemplate("file:views/_partial/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
} }
/* {block "content"} */ /* {block "content"} */
class Block_382193566698cb4496b8402_05526599 extends \Smarty\Runtime\Block class Block_1102964570698cba62b4c8c6_53649331 extends \Smarty\Runtime\Block
{ {
public function callBlock(\Smarty\Template $_smarty_tpl) { public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views'; $_smarty_current_dir = 'D:\\projetphp\\views';

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-11 16:54:33 /* Smarty version 5.7.0, created on 2026-02-11 17:20:34
from 'file:views/_partial/footer.tpl' */ from 'file:views/_partial/footer.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_698cb4497a9957_69792336', 'unifunc' => 'content_698cba62c7aed8_62552440',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array ( array (
), ),
))) { ))) {
function content_698cb4497a9957_69792336 (\Smarty\Template $_smarty_tpl) { function content_698cba62c7aed8_62552440 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial'; $_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
?> ?>
<footer class="footer container-fluid d-flex justify-content-around"> <footer class="footer container-fluid d-flex justify-content-around">

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-11 16:54:28 /* Smarty version 5.7.0, created on 2026-02-11 17:15:22
from 'file:views/_partial/preview.tpl' */ from 'file:views/_partial/preview.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_698cb444c774d7_84020681', 'unifunc' => 'content_698cb92a3aa989_86517927',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array ( array (
), ),
))) { ))) {
function content_698cb444c774d7_84020681 (\Smarty\Template $_smarty_tpl) { function content_698cb92a3aa989_86517927 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial'; $_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
?> ?>

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-11 16:54:33 /* Smarty version 5.7.0, created on 2026-02-11 17:15:22
from 'file:views/search.tpl' */ from 'file:views/search.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_698cb449528ce0_29774694', 'unifunc' => 'content_698cb92a0876d1_70933700',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -21,18 +21,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'file:views/_partial/preview.tpl' => 1, 'file:views/_partial/preview.tpl' => 1,
), ),
))) { ))) {
function content_698cb449528ce0_29774694 (\Smarty\Template $_smarty_tpl) { function content_698cb92a0876d1_70933700 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views'; $_smarty_current_dir = 'D:\\projetphp\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true); $_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?> ?>
<?php <?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1725036509698cb4495172e5_57583375', "content"); $_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_17092653698cb92a075e12_78860742', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir); $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
} }
/* {block "content"} */ /* {block "content"} */
class Block_1725036509698cb4495172e5_57583375 extends \Smarty\Runtime\Block class Block_17092653698cb92a075e12_78860742 extends \Smarty\Runtime\Block
{ {
public function callBlock(\Smarty\Template $_smarty_tpl) { public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views'; $_smarty_current_dir = 'D:\\projetphp\\views';

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-11 16:54:33 /* Smarty version 5.7.0, created on 2026-02-11 17:20:34
from 'file:views/_partial/header.tpl' */ from 'file:views/_partial/header.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_698cb44972d2f4_15349681', 'unifunc' => 'content_698cba62bdf239_98152130',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array ( array (
), ),
))) { ))) {
function content_698cb44972d2f4_15349681 (\Smarty\Template $_smarty_tpl) { function content_698cba62bdf239_98152130 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial'; $_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
?><!DOCTYPE html> ?><!DOCTYPE html>
<html lang="fr"> <html lang="fr">

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-11 16:42:44 /* Smarty version 5.7.0, created on 2026-02-11 17:16:03
from 'file:views/login.tpl' */ from 'file:views/login.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_698cb184850a13_72728685', 'unifunc' => 'content_698cb953b608a8_76956629',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -20,18 +20,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array ( array (
), ),
))) { ))) {
function content_698cb184850a13_72728685 (\Smarty\Template $_smarty_tpl) { function content_698cb953b608a8_76956629 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views'; $_smarty_current_dir = 'D:\\projetphp\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true); $_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?> ?>
<?php <?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1715533627698cb184847324_20686696', "content"); $_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1066475645698cb953b56638_10931349', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir); $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
} }
/* {block "content"} */ /* {block "content"} */
class Block_1715533627698cb184847324_20686696 extends \Smarty\Runtime\Block class Block_1066475645698cb953b56638_10931349 extends \Smarty\Runtime\Block
{ {
public function callBlock(\Smarty\Template $_smarty_tpl) { public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views'; $_smarty_current_dir = 'D:\\projetphp\\views';

View file

@ -7,7 +7,7 @@
<main class="container py-5"> <main class="container py-5">
<!-- Centrage horizontal du formulaire --> <!-- Centrage horizontal du formulaire -->
<div class="row justify-content-center"> <div class="row justify-content-center position-relative">
<div class="col-12 col-md-10 col-lg-6"> <div class="col-12 col-md-10 col-lg-6">
<!-- Carte contenant le formulaire d'inscription --> <!-- Carte contenant le formulaire d'inscription -->
@ -20,7 +20,13 @@
<p class="text-secondary mb-4"> <p class="text-secondary mb-4">
Créez votre compte utilisateur. Créez votre compte utilisateur.
</p> </p>
{if (isset($arrError) && count($arrError) > 0) }
<div class="alert alert-danger">
{foreach $arrError as $strError}
<p>{$strError}</p>
{/foreach}
</div>
{/if}
<!-- Formulaire d'inscription --> <!-- Formulaire d'inscription -->
<!-- Les données seront traitées côté serveur en PHP via la méthode POST --> <!-- Les données seront traitées côté serveur en PHP via la méthode POST -->
<form method="POST"> <form method="POST">
@ -98,6 +104,19 @@
required required
> >
</div> </div>
<!-- Champ : confirmer le mot de passe -->
<div class="col-12">
<label class="form-label" for="pwd_confirm">
Confirmer le Mot de passe *
</label>
<input
class="form-control"
type="password"
id="pwd_confirm"
name="pwd_confirm"
required
>
</div>
<!-- Champ optionnel : numéro de téléphone --> <!-- Champ optionnel : numéro de téléphone -->
<div class="col-12"> <div class="col-12">