2021-01-22 21:58:46 +01:00
|
|
|
<?php require "../top.inc.php"; ?>
|
|
|
|
|
2021-01-23 17:26:46 +01:00
|
|
|
<form method="post">
|
2021-01-22 21:58:46 +01:00
|
|
|
<label for="username">Identifiant</label><br>
|
2021-02-12 15:32:48 +01:00
|
|
|
<input required="" minlength="4" maxlength="32" pattern="<?= USERNAME_REGEX ?>" id="username" name="username" type="text" placeholder="proudhon"><br>
|
2021-01-22 21:58:46 +01:00
|
|
|
|
|
|
|
<label for="password">Mot de passe</label><br>
|
2021-02-12 15:32:48 +01:00
|
|
|
<input required="" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" id="password" name="password" type="password" placeholder="************"><br>
|
2021-01-22 21:58:46 +01:00
|
|
|
|
2021-01-23 17:26:46 +01:00
|
|
|
<input type="submit">
|
2021-01-22 21:58:46 +01:00
|
|
|
</form>
|
|
|
|
|
2021-02-12 15:32:48 +01:00
|
|
|
Pas de compte ? <a class="authButton" href="register">En créer un</a>
|
2021-01-25 13:39:31 +01:00
|
|
|
|
2021-01-22 21:58:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
if (isset($_POST['username']) AND isset($_POST['password'])) {
|
|
|
|
|
2021-02-12 15:32:48 +01:00
|
|
|
if (!checkPasswordFormat($_POST['password']))
|
|
|
|
exit("Le format du mot de passe n'est pas valide !");
|
2021-01-22 21:58:46 +01:00
|
|
|
|
2021-02-12 15:32:48 +01:00
|
|
|
if (!checkUsernameFormat($_POST['username']))
|
|
|
|
exit("Le format du nom du compte n'est pas valide !");
|
2021-01-22 21:58:46 +01:00
|
|
|
|
2021-02-12 15:32:48 +01:00
|
|
|
if (checkPassword($_POST['username'], $_POST['password'])) {
|
|
|
|
$_SESSION['username'] = htmlspecialchars($_POST['username']);
|
|
|
|
$_SESSION['sftp_enabled'] = sftpStatus($_SESSION['username']);
|
2021-02-16 19:20:19 +01:00
|
|
|
if (isset($_GET['redir'])) {
|
|
|
|
if (preg_match("/^[0-9a-z\/-]+$/", $_GET['redir']))
|
|
|
|
header('Location: ' . PREFIX . "/" . $_GET['redir']);
|
|
|
|
else
|
|
|
|
exit("ERROR : Wrong caracter in redir argument");
|
|
|
|
} else {
|
|
|
|
header('Location: ' . PREFIX);
|
|
|
|
}
|
2021-02-12 15:32:48 +01:00
|
|
|
exit;
|
2021-01-22 21:58:46 +01:00
|
|
|
} else {
|
2021-02-12 15:32:48 +01:00
|
|
|
echo "<br>Connexion impossible : mot de passe invalide";
|
2021-01-22 21:58:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<?php require "../bottom.inc.php"; ?>
|