commit
c8458a3150
5 changed files with 511 additions and 150 deletions
|
|
@ -43,19 +43,105 @@ class UserCtrl{
|
||||||
include("../app/views/login.php");
|
include("../app/views/login.php");
|
||||||
include("../app/views/partials/footer.php");
|
include("../app/views/partials/footer.php");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function logout(){
|
public function logout(){
|
||||||
session_start();
|
session_start();
|
||||||
|
/*session_destroy();
|
||||||
// on supprime l'utilisateur en session
|
session_start();*/
|
||||||
unset($_SESSION['user']);
|
|
||||||
|
// on supprime l'utilisateur en session
|
||||||
$_SESSION['success'] = "Vous êtes bien déconnecté";
|
unset($_SESSION['user']);
|
||||||
|
|
||||||
header("Location:index.php");
|
$_SESSION['success'] = "Vous êtes bien déconnecté";
|
||||||
exit;
|
|
||||||
|
header("Location:index.php");
|
||||||
|
exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public function signin(){
|
||||||
|
|
||||||
|
// Inclusion du header
|
||||||
|
include("../app/views/partials/header.php");
|
||||||
|
|
||||||
|
// Entité pour réafficher les valeurs dans le formulaire
|
||||||
|
$objUser = new User();
|
||||||
|
|
||||||
|
// Récupération des champs
|
||||||
|
$strPwdConfirm = $_POST['pwd_confirm'] ?? "";
|
||||||
|
|
||||||
|
// Tableau d'erreurs
|
||||||
|
$arrError = [];
|
||||||
|
|
||||||
|
// Traitement du formulaire uniquement si POST
|
||||||
|
if (!empty($_POST)) {
|
||||||
|
|
||||||
|
// Hydratation
|
||||||
|
$objUser->setName($_POST['user_name'] ?? "");
|
||||||
|
$objUser->setFirstname($_POST['user_firstname'] ?? "");
|
||||||
|
$objUser->setMail($_POST['user_mail'] ?? "");
|
||||||
|
$objUser->setPseudo($_POST['user_pseudo'] ?? "");
|
||||||
|
$objUser->setPwd($_POST['user_password'] ?? "");
|
||||||
|
|
||||||
|
// Champs optionnels : on les stocke aussi même si ils sont vides
|
||||||
|
$objUser->setPhone($_POST['user_phone'] ?? "");
|
||||||
|
$objUser->setWork($_POST['user_work'] ?? "");
|
||||||
|
$objUser->setLocation($_POST['user_location'] ?? "");
|
||||||
|
$objUser->setDescription($_POST['user_description'] ?? "");
|
||||||
|
|
||||||
|
|
||||||
|
// --- VALIDATIONS (obligatoires) ---
|
||||||
|
if (trim($objUser->getName()) === "") {
|
||||||
|
$arrError['user_name'] = "Le nom est obligatoire";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trim($objUser->getFirstname()) === "") {
|
||||||
|
$arrError['user_firstname'] = "Le prénom est obligatoire";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trim($objUser->getMail()) === "") {
|
||||||
|
$arrError['user_mail'] = "Le mail est obligatoire";
|
||||||
|
} elseif (!filter_var($objUser->getMail(), FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$arrError['user_mail'] = "Le format du mail n'est pas correct";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trim($objUser->getPseudo()) === "") {
|
||||||
|
$arrError['user_pseudo'] = "Le pseudo est obligatoire";
|
||||||
|
}
|
||||||
|
|
||||||
|
$strRegex = "/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{16,}$/";
|
||||||
|
if ($objUser->getPwd() == ""){
|
||||||
|
$arrError['user_password'] = "Le mot de passe est obligatoire";
|
||||||
|
}else if (!preg_match($strRegex, $objUser->getPwd())){
|
||||||
|
$arrError['user_password'] = "Le mot de passe ne correspond pas aux règles";
|
||||||
|
}else if($objUser->getPwd() != $strPwdConfirm){
|
||||||
|
$arrError['pwd_confirm'] = "Le mot de passe et sa confirmation ne sont pas identiques";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Si pas d'erreurs => insertion
|
||||||
|
if (count($arrError) === 0) {
|
||||||
|
$objUserModel = new UserModel();
|
||||||
|
$boolInsert = $objUserModel->insert($objUser);
|
||||||
|
|
||||||
|
if ($boolInsert === true) {
|
||||||
|
$_SESSION['success'] = "Compte créé avec succès";
|
||||||
|
header("Location:index.php?ctrl=user&action=login");
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
// Erreur globale (pas liée à un champ)
|
||||||
|
$arrError['global'] = "Erreur lors de l'ajout";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Affichage de la vue inscription
|
||||||
|
include("../app/views/inscription.php");
|
||||||
|
include("../app/views/partials/footer.php");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
124
app/entity/user_entity.php
Normal file
124
app/entity/user_entity.php
Normal file
|
|
@ -0,0 +1,124 @@
|
||||||
|
<?php
|
||||||
|
require_once("mother_entity.php");
|
||||||
|
|
||||||
|
class User extends Entity{
|
||||||
|
private int $_id;
|
||||||
|
private string $_name = '';
|
||||||
|
private string $_firstname = '';
|
||||||
|
private string $_pseudo = '';
|
||||||
|
private string $_image = '';
|
||||||
|
private string $_mail = '';
|
||||||
|
private string $_pwd;
|
||||||
|
private string $_phone = '';
|
||||||
|
private string $_work = '';
|
||||||
|
private string $_birth = '';
|
||||||
|
private string $_location = '';
|
||||||
|
private string $_description = '';
|
||||||
|
private string $_account_creation = '';
|
||||||
|
private int $_status;
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
$this->_prefix = 'user_';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId():int{
|
||||||
|
return $this->_id;
|
||||||
|
}
|
||||||
|
public function setId(int $id){
|
||||||
|
$this->_id = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName():string{
|
||||||
|
return $this->_name;
|
||||||
|
}
|
||||||
|
public function setName(string $name){
|
||||||
|
$this->_name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFirstname():string{
|
||||||
|
return $this->_firstname;
|
||||||
|
}
|
||||||
|
public function setFirstname(string $firstname){
|
||||||
|
$this->_firstname = $firstname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPseudo():string{
|
||||||
|
return $this->_pseudo;
|
||||||
|
}
|
||||||
|
public function setPseudo(string $pseudo){
|
||||||
|
$this->_pseudo = $pseudo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImage():string{
|
||||||
|
return $this->_image;
|
||||||
|
}
|
||||||
|
public function setImage(string $image){
|
||||||
|
$this->_image = $image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMail():string{
|
||||||
|
return $this->_mail;
|
||||||
|
}
|
||||||
|
public function setMail(string $mail){
|
||||||
|
$this->_mail = strtolower($mail);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPwd():string{
|
||||||
|
return $this->_pwd;
|
||||||
|
}
|
||||||
|
public function getPwdHash():string{
|
||||||
|
return password_hash($this->_pwd, PASSWORD_DEFAULT);
|
||||||
|
}
|
||||||
|
public function setPwd(string $pwd){
|
||||||
|
$this->_pwd = $pwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPhone():string{
|
||||||
|
return $this->_phone;
|
||||||
|
}
|
||||||
|
public function setPhone(string $phone){
|
||||||
|
$this->_phone = $phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWork():string{
|
||||||
|
return $this->_work;
|
||||||
|
}
|
||||||
|
public function setWork(string $work){
|
||||||
|
$this->_work = $work;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBirth():string{
|
||||||
|
return $this->_birth;
|
||||||
|
}
|
||||||
|
public function setBirth(string $birth){
|
||||||
|
$this->_birth = $birth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLocation():string{
|
||||||
|
return $this->_location;
|
||||||
|
}
|
||||||
|
public function setLocation(string $location){
|
||||||
|
$this->_location = $location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription():string{
|
||||||
|
return $this->_description;
|
||||||
|
}
|
||||||
|
public function setDescription(string $description){
|
||||||
|
$this->_description = $description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAccountCreation():string{
|
||||||
|
return $this->_account_creation;
|
||||||
|
}
|
||||||
|
public function setAccountCreation(string $account_creation){
|
||||||
|
$this->_account_creation = $account_creation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatus():int{
|
||||||
|
return $this->_status;
|
||||||
|
}
|
||||||
|
public function setStatus(int $status){
|
||||||
|
$this->_status = $status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Traitement des requêtes pour les utilisateurs
|
* Traitement des requêtes pour les utilisateurs
|
||||||
* @author : Christel
|
* @author : meilleurGroup
|
||||||
* @version : V0.5
|
* @version : V0.5
|
||||||
*/
|
*/
|
||||||
class UserModel extends Connect{
|
class UserModel extends Connect{
|
||||||
|
|
@ -58,17 +58,31 @@
|
||||||
public function insert(object $objUser):bool{
|
public function insert(object $objUser):bool{
|
||||||
|
|
||||||
// 2. Construire la requête
|
// 2. Construire la requête
|
||||||
$strRq = "INSERT INTO users (user_name, user_firstname, user_mail, user_pwd)
|
/*$strRq = "INSERT INTO users (user_name, user_firstname, user_mail, user_pwd)
|
||||||
VALUES (:name, :firstname, :mail, :pwd)";
|
VALUES ('".$objUser->getName()."',
|
||||||
|
'".$objUser->getFirstname()."',
|
||||||
|
'".$objUser->getMail()."',
|
||||||
|
'".$objUser->getPwdHash()."')";*/
|
||||||
|
$strRq = "INSERT INTO users (user_name, user_firstname, user_pseudo, user_mail, user_password, user_phone, user_work, user_location, user_description)
|
||||||
|
VALUES (:name, :firstname, :pseudo,:mail, :pwd, :phone, :work, :location,:description)";
|
||||||
// Préparer la requête
|
// Préparer la requête
|
||||||
$rqPrep = $this->_db->prepare($strRq);
|
$rqPrep = $this->_db->prepare($strRq);
|
||||||
// Donne les informations
|
// Donne les informations
|
||||||
$rqPrep->bindValue(":name", $objUser->getName(), PDO::PARAM_STR);
|
$rqPrep->bindValue(":name", $objUser->getName(), PDO::PARAM_STR);
|
||||||
$rqPrep->bindValue(":firstname", $objUser->getFirstname(), PDO::PARAM_STR);
|
$rqPrep->bindValue(":firstname", $objUser->getFirstname(), PDO::PARAM_STR);
|
||||||
|
$rqPrep->bindValue(":pseudo", $objUser->getPseudo(), PDO::PARAM_STR);
|
||||||
$rqPrep->bindValue(":mail", $objUser->getMail(), PDO::PARAM_STR);
|
$rqPrep->bindValue(":mail", $objUser->getMail(), PDO::PARAM_STR);
|
||||||
$rqPrep->bindValue(":pwd", $objUser->getPwdHash(), PDO::PARAM_STR);
|
$rqPrep->bindValue(":pwd", $objUser->getPwdHash(), PDO::PARAM_STR);
|
||||||
|
$rqPrep->bindValue(':phone', $objUser->getPhone() ?? "", PDO::PARAM_STR);
|
||||||
|
$rqPrep->bindValue(':work', $objUser->getWork() ?? "", PDO::PARAM_STR);
|
||||||
|
$rqPrep->bindValue(':location', $objUser->getLocation() ?? "", PDO::PARAM_STR);
|
||||||
|
$rqPrep->bindValue(':description', $objUser->getDescription() ?? "", PDO::PARAM_STR);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 3. Executer la requête
|
// 3. Executer la requête
|
||||||
|
//var_dump($strRq);die;
|
||||||
|
//return $db->exec($strRq);
|
||||||
return $rqPrep->execute();
|
return $rqPrep->execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
|
<!-- Contenu principal de la page -->
|
||||||
|
<main class="container py-5">
|
||||||
|
|
||||||
|
<!-- Centrage horizontal du formulaire -->
|
||||||
|
<div class="row justify-content-center">
|
||||||
<!-- Contenu principal de la page -->
|
<!-- Contenu principal de la page -->
|
||||||
<main class="container py-5">
|
<main class="container py-5">
|
||||||
|
|
||||||
|
|
@ -9,89 +13,92 @@
|
||||||
<!-- Carte contenant le formulaire de connexion -->
|
<!-- Carte contenant le formulaire de connexion -->
|
||||||
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
|
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
|
||||||
|
|
||||||
<!-- Titre principal -->
|
<h1 class="h3 fw-bold mb-1">Connexion</h1>
|
||||||
<h1 class="h3 fw-bold mb-1">Connexion</h1>
|
|
||||||
|
|
||||||
<!-- Texte descriptif -->
|
<p class="text-secondary mb-4">
|
||||||
<p class="text-secondary mb-4">
|
Connectez-vous à votre compte.
|
||||||
Connectez-vous à votre compte.
|
</p>
|
||||||
</p>
|
|
||||||
|
|
||||||
<!-- Formulaire de connexion -->
|
<?php
|
||||||
<!-- Le traitement sera effectué en PHP via la méthode POST -->
|
// Affichage des erreurs (validation côté serveur)
|
||||||
<form method="POST">
|
if (!empty($arrError)) { ?>
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
<div class="row g-3">
|
<?php foreach ($arrError as $strError) { ?>
|
||||||
|
<p class="mb-0"><?php echo htmlspecialchars($strError); ?></p>
|
||||||
<!-- Champ : adresse e-mail de l'utilisateur -->
|
<?php } ?>
|
||||||
<div class="col-12">
|
|
||||||
<label for="user_mail" class="form-label">
|
|
||||||
Adresse e-mail
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="email"
|
|
||||||
class="form-control"
|
|
||||||
id="user_mail"
|
|
||||||
name="user_mail"
|
|
||||||
required
|
|
||||||
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Champ : mot de passe -->
|
|
||||||
<div class="col-12">
|
|
||||||
<label for="user_password" class="form-label">
|
|
||||||
Mot de passe
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
class="form-control"
|
|
||||||
id="user_password"
|
|
||||||
name="user_password"
|
|
||||||
required
|
|
||||||
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Option "Se souvenir de moi" (fonctionnalité optionnelle côté PHP) -->
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" id="remember_me" name="remember_me">
|
|
||||||
<label class="form-check-label" for="remember_me">
|
|
||||||
Se souvenir de moi
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<?php } ?>
|
||||||
|
|
||||||
<!-- Bouton de soumission du formulaire -->
|
<!-- Formulaire de connexion -->
|
||||||
<div class="col-12 d-grid mt-2">
|
<form method="POST" action="index.php?ctrl=user&action=login">
|
||||||
<button type="submit" class="btn btn-primary btn-lg rounded-3">
|
|
||||||
Se connecter
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Lien vers la page d'inscription -->
|
<div class="row g-3">
|
||||||
<div class="col-12 text-center">
|
|
||||||
<small class="text-secondary">
|
|
||||||
Pas encore de compte ?
|
|
||||||
<a href="inscription.php" class="link-primary">Créer un compte</a>
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Lien pour la récupération du mot de passe -->
|
<!-- Champ : adresse e-mail -->
|
||||||
<div class="col-12 text-center">
|
<div class="col-12">
|
||||||
<small>
|
<label for="mail" class="form-label">
|
||||||
<a href="#" class="link-primary">
|
Adresse e-mail
|
||||||
Mot de passe oublié ?
|
</label>
|
||||||
</a>
|
<input
|
||||||
</small>
|
type="email"
|
||||||
</div>
|
class="form-control <?php if (isset($arrError['mail'])) { echo 'is-invalid'; } ?>"
|
||||||
|
id="mail"
|
||||||
|
name="mail"
|
||||||
|
value="<?php echo htmlspecialchars($strMail ?? ''); ?>"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
<!-- Champ : mot de passe -->
|
||||||
</form>
|
<div class="col-12">
|
||||||
|
<label for="pwd" class="form-label">
|
||||||
|
Mot de passe
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
class="form-control <?php if (isset($arrError['pwd'])) { echo 'is-invalid'; } ?>"
|
||||||
|
id="pwd"
|
||||||
|
name="pwd"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Option "Se souvenir de moi" -->
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" id="remember_me" name="remember_me">
|
||||||
|
<label class="form-check-label" for="remember_me">
|
||||||
|
Se souvenir de moi
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Bouton -->
|
||||||
|
<div class="col-12 d-grid mt-2">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg rounded-3">
|
||||||
|
Se connecter
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Liens -->
|
||||||
|
<div class="col-12 text-center">
|
||||||
|
<small class="text-secondary">
|
||||||
|
Pas encore de compte ?
|
||||||
|
<a href="index.php?ctrl=user&action=signin" class="link-primary">Créer un compte</a>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 text-center">
|
||||||
|
<small>
|
||||||
|
<a href="#" class="link-primary">
|
||||||
|
Mot de passe oublié ?
|
||||||
|
</a>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</main>
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
|
<!-- Page : Inscription -->
|
||||||
|
<main class="container py-5">
|
||||||
|
|
||||||
|
<!-- Centrage du formulaire -->
|
||||||
|
<div class="row justify-content-center">
|
||||||
<!-- Contenu principal de la page -->
|
<!-- Contenu principal de la page -->
|
||||||
<main class="container py-5">
|
<main class="container py-5">
|
||||||
|
|
||||||
|
|
@ -6,66 +10,193 @@
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<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 Bootstrap contenant le formulaire -->
|
||||||
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
|
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
|
||||||
|
|
||||||
<!-- Titre principal de la page -->
|
<!-- Titre et description -->
|
||||||
<h1 class="h3 fw-bold mb-1">Inscription</h1>
|
<h1 class="h3 fw-bold mb-1">Inscription</h1>
|
||||||
|
<p class="text-secondary mb-4">
|
||||||
|
Créez votre compte utilisateur.
|
||||||
|
</p>
|
||||||
|
|
||||||
<!-- Texte descriptif -->
|
<?php
|
||||||
<p class="text-secondary mb-4">
|
// Affichage des messages d'erreur du formulaire, l'affichage en Bootstrap (validation côté serveur)
|
||||||
Créez votre compte utilisateur.
|
if (!empty($arrError)) { ?>
|
||||||
</p>
|
<div class="alert alert-danger" role="alert">
|
||||||
|
<?php foreach ($arrError as $strError) { ?>
|
||||||
<!-- Formulaire d'inscription -->
|
<p class="mb-0">
|
||||||
<!-- Les données seront traitées côté serveur en PHP via la méthode POST -->
|
<?php echo htmlspecialchars($strError); ?>
|
||||||
<form method="POST">
|
</p>
|
||||||
|
<?php } ?>
|
||||||
<div class="row g-3">
|
|
||||||
|
|
||||||
<!-- Champ : prénom de l'utilisateur -->
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label class="form-label" for="user_firstname">
|
|
||||||
Prénom *
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
id="user_firstname"
|
|
||||||
name="user_firstname"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Champ : nom de l'utilisateur -->
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label class="form-label" for="user_name">
|
|
||||||
Nom *
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
id="user_name"
|
|
||||||
name="user_name"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Champ : pseudo (identifiant public de l'utilisateur) -->
|
|
||||||
<div class="col-12">
|
|
||||||
<label class="form-label" for="user_pseudo">
|
|
||||||
Pseudo *
|
|
||||||
</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<span class="input-group-text">@</span>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
id="user_pseudo"
|
|
||||||
name="user_pseudo"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<!-- Formulaire d'inscription -->
|
||||||
|
<!-- Les données sont envoyées en POST vers la méthode signin du user_controller.php -->
|
||||||
|
<form method="POST" action="index.php?ctrl=user&action=signin">
|
||||||
|
|
||||||
|
<div class="row g-3">
|
||||||
|
|
||||||
|
<!-- Champ : Nom -->
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label" for="user_name">
|
||||||
|
Nom *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control <?php if (isset($arrError['user_name'])) echo 'is-invalid'; ?>"
|
||||||
|
type="text"
|
||||||
|
id="user_name"
|
||||||
|
name="user_name"
|
||||||
|
value="<?php echo htmlspecialchars($objUser->getName()); ?>"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ : Prénom -->
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label" for="user_firstname">
|
||||||
|
Prénom *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control <?php if (isset($arrError['user_firstname'])) echo 'is-invalid'; ?>"
|
||||||
|
type="text"
|
||||||
|
id="user_firstname"
|
||||||
|
name="user_firstname"
|
||||||
|
value="<?php echo htmlspecialchars($objUser->getFirstname()); ?>"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ : Pseudo -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_pseudo">
|
||||||
|
Pseudo *
|
||||||
|
</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-text">@</span>
|
||||||
|
<input
|
||||||
|
class="form-control <?php if (isset($arrError['user_pseudo'])) echo 'is-invalid'; ?>"
|
||||||
|
type="text"
|
||||||
|
id="user_pseudo"
|
||||||
|
name="user_pseudo"
|
||||||
|
value="<?php echo htmlspecialchars($objUser->getPseudo()); ?>"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ : Adresse e-mail -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_mail">
|
||||||
|
Adresse e-mail *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control <?php if (isset($arrError['user_mail'])) echo 'is-invalid'; ?>"
|
||||||
|
type="email"
|
||||||
|
id="user_mail"
|
||||||
|
name="user_mail"
|
||||||
|
value="<?php echo htmlspecialchars($objUser->getMail()); ?>"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ : Mot de passe -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_password">
|
||||||
|
Mot de passe *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control <?php if (isset($arrError['user_password'])) echo 'is-invalid'; ?>"
|
||||||
|
type="password"
|
||||||
|
id="user_password"
|
||||||
|
name="user_password"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ : Confirmation du mot de passe -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="pwd_confirm">
|
||||||
|
Confirmation du mot de passe *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control <?php if (isset($arrError['pwd_confirm'])) echo 'is-invalid'; ?>"
|
||||||
|
type="password"
|
||||||
|
id="pwd_confirm"
|
||||||
|
name="pwd_confirm"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ optionnel : numéro de téléphone -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_phone">
|
||||||
|
Téléphone
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="text"
|
||||||
|
id="user_phone"
|
||||||
|
name="user_phone"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ optionnel : profession de l'utilisateur -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_work">
|
||||||
|
Profession
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="text"
|
||||||
|
id="user_work"
|
||||||
|
name="user_work"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ optionnel : localisation de l'utilisateur -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_location">
|
||||||
|
Localisation
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="text"
|
||||||
|
id="user_location"
|
||||||
|
name="user_location"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ optionnel : phrase d'accroche / description courte -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_description">
|
||||||
|
Phrase d'accroche
|
||||||
|
</label>
|
||||||
|
<textarea
|
||||||
|
class="form-control"
|
||||||
|
id="user_description"
|
||||||
|
name="user_description"
|
||||||
|
rows="3"
|
||||||
|
></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Lien vers la page de connexion -->
|
||||||
|
<div class="col-12 text-center">
|
||||||
|
<small class="text-secondary">
|
||||||
|
Déjà un compte ?
|
||||||
|
<a href="index.php?ctrl=user&action=login">Se connecter</a>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Bouton de soumission -->
|
||||||
|
<div class="col-12 d-grid mt-2">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg rounded-3">
|
||||||
|
Créer mon compte
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Champ : adresse e-mail -->
|
<!-- Champ : adresse e-mail -->
|
||||||
|
|
@ -183,6 +314,5 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue