1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-01-06 00:22:21 +00:00

Design inscription, connexion, calendrier

This commit is contained in:
galaxyoyo 2019-09-24 12:04:42 +02:00
parent e878854861
commit 5724a6c98e
6 changed files with 269 additions and 276 deletions

View File

@ -55,14 +55,13 @@ class LoggingInUser
public function makeVerifications()
{
global $URL_BASE;
ensure(filter_var($this->email, FILTER_VALIDATE_EMAIL), "L'adresse email est invalide.");
$this->user = User::fromEmail($this->email);
ensure($this->user != null, "Le compte n'existe pas.");
ensure($this->user->checkPassword($this->password), "Le mot de passe est incorrect.");
if ($this->user->getConfirmEmailToken() != null) {
$_SESSION["confirm_email"] = $this->email;
/** @noinspection HtmlUnknownTarget */
throw new AssertionError("L'adresse mail n'a pas été validée. Veuillez vérifier votre boîte mail (surtout vos spams). "
. "<a href=\"/connexion/confirmation-mail\">Cliquez ici pour renvoyer le mail de confirmation</a>.");
}
@ -125,7 +124,7 @@ class ResetPassword
ensure($data !== false, "Il n'y a pas de compte à récupérer avec ce jeton.");
$this->user = User::fromId($data["id"]);
if ($this->password == null)
if (!isset($_POST["password"]))
return;
ensure($this->password == $this->confirm_password, "Les deux mots de passe sont différents.");

View File

@ -4,5 +4,11 @@ unset($_SESSION["user_id"]);
session_destroy();
require_once "server_files/views/header.php";
echo "<h2>Déconnexion réussie !</h2>";
?>
<div class="alert alert-success">
Déconnexion réussie !
</div>
<?php
require_once "server_files/views/footer.php";

View File

@ -1,138 +1,128 @@
<?php require_once "header.php"; ?>
<?php if (isset($_GET["edit"])) { ?>
<form method="post">
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="date_inscription">Fin des inscriptions :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_inscription" name="date_inscription"
value="<?= substr($CONFIG->getInscriptionDate(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_inscription" name="time_inscription"
value="<?= substr($CONFIG->getInscriptionDate(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 1 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase1" name="date_start_phase1"
value="<?= substr($CONFIG->getStartPhase1Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase1" name="time_start_phase1"
value="<?= substr($CONFIG->getStartPhase1Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 1 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase1" name="date_end_phase1"
value="<?= substr($CONFIG->getEndPhase1Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase1" name="time_end_phase1"
value="<?= substr($CONFIG->getEndPhase1Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 2 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase2" name="date_start_phase2"
value="<?= substr($CONFIG->getStartPhase2Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase2" name="time_start_phase2"
value="<?= substr($CONFIG->getStartPhase2Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 2 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase2" name="date_end_phase2"
value="<?= substr($CONFIG->getEndPhase2Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase2" name="time_end_phase2"
value="<?= substr($CONFIG->getEndPhase2Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 3 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase3" name="date_start_phase3"
value="<?= substr($CONFIG->getStartPhase3Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase3" name="time_start_phase3"
value="<?= substr($CONFIG->getStartPhase3Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 3 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase3" name="date_end_phase3"
value="<?= substr($CONFIG->getEndPhase3Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase3" name="time_end_phase3"
value="<?= substr($CONFIG->getEndPhase3Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 4 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase4" name="date_start_phase4"
value="<?= substr($CONFIG->getStartPhase4Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase4" name="time_start_phase4"
value="<?= substr($CONFIG->getStartPhase4Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 4 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase4" name="date_end_phase4"
value="<?= substr($CONFIG->getEndPhase4Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase4" name="time_end_phase4"
value="<?= substr($CONFIG->getEndPhase4Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td colspan="2" style="width: 100%;">
<input style="width: 100%;" type="submit" name="update_calendar"
value="Mettre à jour le calendrier"/>
</td>
</tr>
</tbody>
</table>
</form>
<?php } else { ?><h2>Calendrier</h2>
<div class="mt-4 mb-4">
<h1 class="display-4">Calendrier</h1>
</div>
<?= Phase::getTranslatedName(Phase::INSCRIPTION) ?> :
<strong><?= formatDate($CONFIG->getInscriptionDate(), true) ?></strong><br/>
<?= Phase::getTranslatedName(Phase::PHASE1) ?> : Du
<strong><?= formatDate($CONFIG->getStartPhase1Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase1Date(), true) ?></strong><br/>
<?= Phase::getTranslatedName(Phase::PHASE2) ?> : Du
<strong><?= formatDate($CONFIG->getStartPhase2Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase2Date(), true) ?></strong><br/>
<?= Phase::getTranslatedName(Phase::PHASE3) ?> : Du
<strong><?= formatDate($CONFIG->getStartPhase3Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase3Date(), true) ?></strong><br/>
<?= Phase::getTranslatedName(Phase::PHASE4) ?> : Du
<strong><?= formatDate($CONFIG->getStartPhase4Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase4Date(), true) ?></strong><br/>
<br/>
Phase actuelle : <strong><?= Phase::getTranslatedName(Phase::getCurrentPhase()) ?></strong><br/>
<?php if (isset($_GET["edit"])) { ?>
<form method="POST">
<div class="form-group row">
<label for="inscription">Fin des inscriptions :</label>
<div class="form-group col-md-10">
<input class="form-control" type="date" id="inscription" name="date_inscription"
value="<?= substr($CONFIG->getInscriptionDate(), 0, 10) ?>"/>
<input class="form-control" type="time" id="inscription" name="time_inscription"
value="<?= substr($CONFIG->getInscriptionDate(), 11, 5) ?>"/>
</div>
</div>
<div class="form-group row">
<label for="phase1">Dates de la phase 1 :</label>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase1" name="date_start_phase1"
value="<?= substr($CONFIG->getStartPhase1Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase1" name="time_start_phase1"
value="<?= substr($CONFIG->getStartPhase1Date(), 11, 5) ?>"/>
</div>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase1" name="date_end_phase1"
value="<?= substr($CONFIG->getEndPhase1Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase1" name="time_end_phase1"
value="<?= substr($CONFIG->getEndPhase1Date(), 11, 5) ?>"/>
</div>
</div>
<div class="form-group row">
<label for="phase2">Dates de la phase 2 :</label>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase2" name="date_start_phase2"
value="<?= substr($CONFIG->getStartPhase2Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase1" name="time_start_phase2"
value="<?= substr($CONFIG->getStartPhase2Date(), 11, 5) ?>"/>
</div>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase2" name="date_end_phase2"
value="<?= substr($CONFIG->getEndPhase2Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase2" name="time_end_phase2"
value="<?= substr($CONFIG->getEndPhase2Date(), 11, 5) ?>"/>
</div>
</div>
<div class="form-group row">
<label for="phase3">Dates de la phase 3 :</label>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase3" name="date_start_phase3"
value="<?= substr($CONFIG->getStartPhase3Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase3" name="time_start_phase3"
value="<?= substr($CONFIG->getStartPhase3Date(), 11, 5) ?>"/>
</div>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase3" name="date_end_phase3"
value="<?= substr($CONFIG->getEndPhase3Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase3" name="time_end_phase3"
value="<?= substr($CONFIG->getEndPhase3Date(), 11, 5) ?>"/>
</div>
</div>
<div class="form-group row">
<label for="phase4">Dates de la phase 4 :</label>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase4" name="date_start_phase4"
value="<?= substr($CONFIG->getStartPhase4Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase4" name="time_start_phase4"
value="<?= substr($CONFIG->getStartPhase4Date(), 11, 5) ?>"/>
</div>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase4" name="date_end_phase4"
value="<?= substr($CONFIG->getEndPhase4Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase4" name="time_end_phase4"
value="<?= substr($CONFIG->getEndPhase4Date(), 11, 5) ?>"/>
</div>
</div>
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" type="submit" name="update_calendar"
value="Mettre à jour le calendrier"/>
</div>
</form>
<?php } else { ?>
<div class="alert alert-<?= Phase::getCurrentPhase() == Phase::INSCRIPTION ? "warning" : "success" ?>">
<?= Phase::getTranslatedName(Phase::INSCRIPTION) ?> :
<strong><?= formatDate($CONFIG->getInscriptionDate(), true) ?></strong>
</div>
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE1 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE1 ? "warning" : "success") ?>">
<?= Phase::getTranslatedName(Phase::PHASE1) ?> :
Du <strong><?= formatDate($CONFIG->getStartPhase2Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase2Date(), true) ?></strong>
</div>
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE2 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE2 ? "warning" : "success") ?>">
<?= Phase::getTranslatedName(Phase::PHASE2) ?> :
Du <strong><?= formatDate($CONFIG->getStartPhase2Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase2Date(), true) ?></strong>
</div>
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE3 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE3 ? "warning" : "success") ?>">
<?= Phase::getTranslatedName(Phase::PHASE3) ?> :
Du <strong><?= formatDate($CONFIG->getStartPhase3Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase3Date(), true) ?></strong>
</div>
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE4 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE4 ? "warning" : "success") ?>">
<?= Phase::getTranslatedName(Phase::PHASE4) ?> :
Du <strong><?= formatDate($CONFIG->getStartPhase4Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase4Date(), true) ?></strong>
</div>
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
<a href="/calendrier/modifier">Modifier le calendrier</a>
<!--suppress HtmlUnknownTarget -->
<a href="/calendrier/modifier">
<button class="btn btn-primary btn-block">Modifier le calendrier</button>
</a>
<?php }
}

View File

@ -3,96 +3,64 @@ require_once "header.php";
if (!$has_error) {
if (isset($recuperate_account))
echo "<h2>Le mail de récupération de mot de passe a bien été envoyé.</h2>";
elseif (isset($reset_password))
echo "<h2>Le mot de passe a bien été changé. Vous pouvez désormais vous connecter.</h2>";
echo "<div class=\"alert alert-warning\">Le mail de récupération de mot de passe a bien été envoyé.</div>";
elseif (isset($reset_password) && isset($_POST["password"]))
echo "<div class=\"alert alert-success\">Le mot de passe a bien été changé. Vous pouvez désormais vous connecter.</div>";
elseif (isset($_GET["confirmation-mail"]))
echo "<h2>Le mail a bien été renvoyé.</h2>";
echo "<div class=\"alert alert-success\">Le mail a bien été renvoyé.</div>";
else if (isset($logging_in_user)) {
echo "<h2>Connexion réussie !</h2>";
echo "<div class=\"alert alert-success\">Connexion réussie !</div>";
require_once "footer.php";
} else if (isset($_SESSION["user_id"])) {
echo "<h2>Vous êtes déjà connecté.</h2>";
echo "<div class=\"alert alert-danger\">Vous êtes déjà connecté !</div>";
require_once "footer.php";
}
}
if (isset($_GET["mdp-oublie"])) { ?>
<form method="POST">
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="email">E-mail associée au compte :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="email" id="email" name="email"/>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" name="forgotten_password"
value="Envoyer l'e-mail de récupération"/>
</td>
</tr>
</tbody>
</table>
if (isset($_GET["mdp_oublie"])) { ?>
<form method="POST" class="jumbotron mt-5">
<h1 class="display-4">Réinitialisation du mot de passe</h1>
<label for="email">E-mail associée au compte :</label>
<input type="email" class="form-control" id="email" name="email"/>
<input class="btn btn-lg btn-primary btn-block" type="submit" name="forgotten_password"
value="Envoyer l'e-mail de récupération"/>
</form>
<?php } elseif (isset($_GET["reset_password"])) {
if ($reset_password->user != null) { ?>
<form method="POST">
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="password">Nouveau mot de passe :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="password" id="password" name="password"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="confirm_password">Confirmer le mot de passe :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="password" id="confirm_password" name="confirm_password"/>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" name="reset_password"
value="Changer le mot de passe"/>
</td>
</tr>
</tbody>
</table>
</form>
<?php }
} elseif (isset($_GET["confirmation-mail"])) { ?>
<?php } elseif (isset($reset_password) && $reset_password->user != null && ($has_error || !isset($_POST["password"]))) { ?>
<form method="POST" class="jumbotron mt-5">
<h1 class="display-4">Connexion</h1>
<input type="hidden" name="token" value="<?= $_GET["token"] ?>"/>
<div class="form-group">
<label for="password">Nouveau mot de passe :</label>
<input type="password" id="password" name="password" class="form-control"/>
</div>
<div class="form-group">
<label for="confirm_password">Confirmer le mot de passe :</label>
<input type="password" id="confirm_password" name="confirm_password" class="form-control"/>
</div>
<input type="submit" name="reset_password" class="btn btn-block btn-primary"
value="Changer le mot de passe"/>
</form>
<?php } elseif (isset($_GET["confirmation-mail"])) { ?>
<?php } else { ?>
<form method="POST">
<form method="POST" class="jumbotron mt-5">
<h1 class="display-4">Connexion</h1>
<hr class="mt-2 mb-4"/>
<input type="hidden" name="submitted" value="true"/>
<table style="width: 100%;">
<tr>
<td style="width: 30%;"><label for="email">E-mail :</label></td>
<td style="width: 70%;"><input style="width: 100%;" type="email" id="email" name="email"
value="<?php if (isset($email)) echo $email ?>"/></td>
</tr>
<tr>
<td><label for="password">Mot de passe :</label></td>
<td><input style="width: 100%;" type="password" id="password" name="password"/></td>
</tr>
<tr>
<td colspan="2">
<!--suppress HtmlUnknownTarget -->
<a href="/connexion/mdp-oublie">Mot de passe oublié ?</a>
</td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%;" type="submit" value="Se connecter"/></td>
</tr>
</table>
<div class="form-group">
<label for="email">E-mail :</label>
<input class="form-control" type="email" id="email" name="email"
value="<?php if (isset($email)) echo $email ?>"/>
</div>
<div class="form-group">
<label for="password">Mot de passe :</label>
<input class="form-control" type="password" id="password" name="password"/>
</div>
<input class="btn btn-primary btn-block" type="submit" value="Se connecter"/>
</form>
<div class="alert">
<!--suppress HtmlUnknownTarget -->
<a href="/connexion/mdp-oublie">Mot de passe oublié ?</a>
</div>
<?php } ?>
<?php require_once "footer.php" ?>
<?php require_once "footer.php" ?>

View File

@ -100,8 +100,12 @@
</div>
<div class="container">
<div class="mt-4 mb-4">
</div>
<?php
if (isset($has_error) && $has_error) {
echo "<h2>Erreur : " . $error_message . "</h2>";
}
if (isset($has_error) && $has_error) { ?>
<div class="alert alert-danger">
Erreur : <?= $error_message ?>
</div>
<?php }

View File

@ -1,74 +1,100 @@
<?php
require_once "header.php";
?>
<div class="mt-4 mb-4">
<h1 class="display-4">Formulaire d'inscription</h1>
</div>
<?php
/** @var NewUser $user */
if (isset($user) && !$has_error) {
?>
Votre inscription est validée ! Merci désormais de confirmer votre boîte mail pour valider votre adresse.
<div class="alert alert-success">
Votre inscription est validée ! Merci désormais de confirmer votre boîte mail pour valider votre adresse.
</div>
<?php } else if (isset($_SESSION["user_id"])) { ?>
<h2>Vous êtes déjà connecté !</h2>
<div class="alert alert-danger">
Vous êtes déjà connecté !
</div>
<?php } elseif(date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate()) { ?>
<h2>La date limite d'inscription est dépassée.</h2>
<div class="alert alert-danger">
La date limite d'inscription est dépassée.
</div>
<?php } else { ?>
<form method="POST">
<input type="hidden" name="submitted" value="true"/>
<table style="width: 100%;">
<tr>
<td style="width: 30%;"><label for="email">E-mail :</label></td>
<td style="width: 70%;"><input style="width: 100%;" type="email" id="email" name="email"
value="<?php if (isset($user)) echo $user->email ?>"
required/></td>
</tr>
<tr>
<td><label for="password">Mot de passe :</label></td>
<td><input style="width: 100%;" type="password" id="password" name="password" required/></td>
</tr>
<tr>
<td><label for="confirm_password">Confirmer le mot de passe :</label></td>
<td><input style="width: 100%;" type="password" id="confirm_password" name="confirm_password" required/>
</td>
</tr>
<tr>
<td><label for="surname">Nom :</label></td>
<td><input style="width: 100%;" type="text" id="surname" name="surname"
value="<?php if (isset($user)) echo $user->surname ?>" required/></td>
</tr>
<tr>
<td><label for="first_name">Prénom :</label></td>
<td><input style="width: 100%;" type="text" id="first_name" name="first_name"
value="<?php if (isset($user)) echo $user->first_name ?>" required/></td>
</tr>
<tr>
<td><label for="role">Rôle :</label></td>
<td><select style="width: 100%;" id="role" name="role" onchange="selectRole()">
<option value="participant"><?= Role::getTranslatedName(Role::PARTICIPANT) ?></option>
<option value="encadrant"><?= Role::getTranslatedName(Role::ENCADRANT) ?></option>
</select></td>
</tr>
<tr>
<td><label id="school_label" for="school">Établissement dans lequel l'élève étudie :</label></td>
<td><input style="width: 100%;" type="text" id="school" name="school"
value="<?php if (isset($user)) echo $user->school ?>"/></td>
</tr>
<tr>
<td><label id="class_label" for="class">Classe :</label></td>
<td><select style="width: 100%;" id="class" name="class">
<option value="terminale"><?= SchoolClass::getTranslatedName(SchoolClass::TERMINALE) ?></option>
<option value="premiere"><?= SchoolClass::getTranslatedName(SchoolClass::PREMIERE) ?></option>
<option value="seconde"><?= SchoolClass::getTranslatedName(SchoolClass::SECONDE) ?></option>
</select></td>
</tr>
<tr>
<td><label id="description_label" for="description">Description :</label></td>
<td><textarea style="width: 100%;" id="description"
name="description"><?php if (isset($user)) echo $user->description ?></textarea>
</td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%;" type="submit" value="S'inscrire"/></td>
</tr>
</table>
<div class="form-group row">
<label for="role">Rôle :</label>
<select id="role" name="role" onchange="selectRole()" class="custom-select">
<option value="participant"><?= Role::getTranslatedName(Role::PARTICIPANT) ?></option>
<option value="encadrant"><?= Role::getTranslatedName(Role::ENCADRANT) ?></option>
</select>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="surname">Nom :</label>
<input class="form-control" type="text" id="surname" name="surname"
value="<?php if (isset($user)) echo $user->surname ?>" required/>
</div>
<div class="form-group col-md-6">
<label for="first_name">Prénom :</label>
<input class="form-control" type="text" id="first_name" name="first_name"
value="<?php if (isset($user)) echo $user->first_name ?>" required/>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="email">E-mail :</label>
<input class="form-control" type="email" id="email" name="email"
value="<?php if (isset($user)) echo $user->email ?>"
required/>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="password">Mot de passe :</label>
<input class="form-control" type="password" id="password" name="password" required/>
</div>
<div class="form-group col-md-6">
<label for="confirm_password">Confirmer le mot de passe :</label>
<input class="form-control" type="password" id="confirm_password" name="confirm_password" required/>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label id="school_label" for="school">Établissement dans lequel l'élève étudie :</label>
<input class="form-control" type="text" id="school" name="school"
value="<?php if (isset($user)) echo $user->school ?>"/>
</div>
<div class="form-group col-md-6">
<label id="class_label" for="class">Classe :</label>
<select id="class" name="class" class="custom-select">
<option value="terminale"><?= SchoolClass::getTranslatedName(SchoolClass::TERMINALE) ?></option>
<option value="premiere"><?= SchoolClass::getTranslatedName(SchoolClass::PREMIERE) ?></option>
<option value="seconde"><?= SchoolClass::getTranslatedName(SchoolClass::SECONDE) ?></option>
</select>
</div>
</div>
<div class="form-group row">
<label id="description_label" for="description">Description :</label>
<textarea class="form-control" id="description"
name="description"><?php if (isset($user)) echo $user->description ?></textarea>
</div>
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" type="submit" value="S'inscrire"/>
</div>
</form>
<script>