2022-09-01 04:21:17 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
if (processForm(false)) {
|
|
|
|
checkPasswordFormat($_POST['password']);
|
|
|
|
|
|
|
|
checkUsernameFormat($_POST['username']);
|
|
|
|
|
|
|
|
if (userExist($_POST['username']) !== true)
|
2022-09-15 19:17:48 +02:00
|
|
|
output(403, 'Connexion impossible : ce compte n\'existe pas.');
|
2022-09-01 04:21:17 +02:00
|
|
|
|
|
|
|
if (checkPassword($_POST['username'], $_POST['password']) !== true)
|
2022-09-15 19:17:48 +02:00
|
|
|
output(403, 'Connexion impossible : clé de passe invalide.');
|
2022-09-01 04:21:17 +02:00
|
|
|
|
|
|
|
$_SESSION['username'] = $_POST['username'];
|
|
|
|
|
|
|
|
if (outdatedPasswordHash($_SESSION['username']))
|
|
|
|
changePassword($_SESSION['username'], $_POST['password']);
|
|
|
|
|
|
|
|
redir();
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
2021-01-22 21:58:46 +01:00
|
|
|
|
2022-06-06 23:14:50 +02:00
|
|
|
<p>Pas de compte ? <a class="auth" href="register">En créer un</a></p>
|
|
|
|
|
2021-02-17 22:48:49 +01:00
|
|
|
<form method="post">
|
2022-04-18 16:05:00 +02:00
|
|
|
<label for="username">Identifiant</label><br>
|
2022-06-10 21:14:47 +02:00
|
|
|
<input required="" minlength="4" maxlength="32" pattern="<?= USERNAME_REGEX ?>" id="username" name="username" type="text" placeholder="<?= PLACEHOLDER_USERNAME ?>">
|
2022-04-18 16:05:00 +02:00
|
|
|
<br>
|
2021-01-22 21:58:46 +01:00
|
|
|
|
2022-04-18 16:05:00 +02:00
|
|
|
<label for="password">Clé de passe</label><br>
|
2022-06-10 21:14:47 +02:00
|
|
|
<input required="" autocomplete="current-password" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" id="password" name="password" type="password" placeholder="<?= PLACEHOLDER_PASSWORD ?>">
|
2022-04-18 16:05:00 +02:00
|
|
|
<br>
|
2021-01-22 21:58:46 +01:00
|
|
|
|
2022-04-18 16:05:00 +02:00
|
|
|
<input type="submit">
|
2021-02-17 22:48:49 +01:00
|
|
|
</form>
|