diff --git a/config.ini b/config.ini index 50f411c..c4654d6 100644 --- a/config.ini +++ b/config.ini @@ -2,12 +2,6 @@ root_path = "/srv/php/niver" ; Prefix in URL, if any prefix = -; From RFC2606: Reserved Top Level DNS Names > 2. TLDs for Testing, & Documentation Examples -domain_example = "example" -; From RFC3849: IPv6 Address Prefix Reserved for Documentation -ipv6_example = "2001:db8::3" -; From RFC5737: IPv4 Address Blocks Reserved for Documentation -ipv4_example = "203.0.113.42" [dns] knotc_path = "/usr/sbin/knotc" diff --git a/fn/auth.php b/fn/auth.php index f2b6809..40e3f95 100644 --- a/fn/auth.php +++ b/fn/auth.php @@ -3,6 +3,9 @@ define("USERNAME_REGEX", "^[a-z]{4,32}$"); define("PASSWORD_REGEX", "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{8,1024}|.{10,1024}$"); +define("PLACEHOLDER_USERNAME", "lain"); +define("PLACEHOLDER_PASSWORD", "••••••••••••••••••••••••"); + // Password storage security define("ALGO_PASSWORD", PASSWORD_ARGON2ID); define("OPTIONS_PASSWORD", array( diff --git a/fn/dns.php b/fn/dns.php index 6476942..fe5cf00 100644 --- a/fn/dns.php +++ b/fn/dns.php @@ -1,5 +1,9 @@ 2. TLDs for Testing, & Documentation Examples +define("PLACEHOLDER_IPV6", "2001:db8::3"); // From RFC3849: IPv6 Address Prefix Reserved for Documentation +define("PLACEHOLDER_IPV4", "203.0.113.42"); // From RFC5737: IPv4 Address Blocks Reserved for Documentation + function knotcExec($suffix, $cmd) { $action = checkAction($_POST['action']); diff --git a/public/auth/index.php b/public/auth/index.php index 8802532..b82a007 100644 --- a/public/auth/index.php +++ b/public/auth/index.php @@ -1,17 +1,22 @@ - - -Se déconnecter -
-Changer la clé de passe - - - Vous devez être authentifié·e pour utiliser Niver -
- Créer un compte -
- Se connecter - +
+
Créer un compte
+
+ Créer un nouveau compte Niver +
+
Se connecter
+
+ Démarrer une nouvelle session avec un compte existant +
+
Se déconnecter
+
+ Terminer la session et effacer ses cookies +
+
Changer la clé de passe
+
+ Changer la chaîne de caractères permettant de vous authentifier. +
+
diff --git a/public/auth/login.php b/public/auth/login.php index 67bb24c..15c9c6f 100644 --- a/public/auth/login.php +++ b/public/auth/login.php @@ -4,11 +4,11 @@

- +

- +
@@ -16,32 +16,29 @@ redir."); - header("Location: " . CONF['common']['prefix'] . "/" . $_GET['redir']); - } else { - header("Location: " . CONF['common']['prefix'] . "/"); - } +if (isset($_GET['redir'])) { + if (preg_match("/^[0-9a-z\/-]+$/", $_GET['redir']) !== 1) + userError("Wrong character in redir."); + header("Location: " . CONF['common']['prefix'] . "/" . $_GET['redir']); +} else { + header("Location: " . CONF['common']['prefix'] . "/"); } -?> - - +success("Connecté·e."); diff --git a/public/auth/logout.php b/public/auth/logout.php index f666f14..fce9780 100644 --- a/public/auth/logout.php +++ b/public/auth/logout.php @@ -1,10 +1,10 @@ - - +success("Déconnecté·e."); diff --git a/public/auth/password.php b/public/auth/password.php index a55e681..fc15e8f 100644 --- a/public/auth/password.php +++ b/public/auth/password.php @@ -1,40 +1,28 @@

- Vous pouvez ici changer le mot de passe permettant d'accéder à votre compte Niver. + Vous pouvez ici changer la clé de passe permettant d'accéder à votre compte Niver.

-
-
+
+
-
-
+
+
prepare("UPDATE users SET password = :password WHERE username = :username"); - - $stmt->bindParam(':username', $_SESSION['username']); - $stmt->bindParam(':password', $newPassword); - - $stmt->execute(); -} - -?> - - +success("Clé de passe changée."); diff --git a/public/auth/register.php b/public/auth/register.php index 5983189..f0b3e5a 100644 --- a/public/auth/register.php +++ b/public/auth/register.php @@ -2,63 +2,13 @@

Déjà un compte ? Se connecter

-prepare("INSERT INTO users(username, password, registration_date) VALUES(:username, :password, :registration_date)"); - - $time = date("Y-m-d H:i:s"); - - $stmt->bindParam(':username', $_POST['username']); - $stmt->bindParam(':password', $password); - $stmt->bindParam(':registration_date', $time); - - $stmt->execute(); - - $_SESSION['username'] = $_POST['username']; - - header('Location: ' . CONF['common']['prefix'] . '/'); - exit; - } - -} - -?> -
Uniquement composé de lettres minuscules.
-
- -Cet identifiant est déjà utilisé. Choisissez-en un autre."; -} -?> +
@@ -66,9 +16,46 @@ if (isset($userExist) AND $userExist === true) {

Minimum 8 caractères si elle contient minuscule, majuscule et chiffre, ou minimum 10 caractères sinon.

-
+
- +prepare("INSERT INTO users(username, password, registration_date) VALUES(:username, :password, :registration_date)"); + +$time = date("Y-m-d H:i:s"); + +$stmt->bindParam(':username', $_POST['username']); +$stmt->bindParam(':password', $password); +$stmt->bindParam(':registration_date', $time); + +$stmt->execute(); + +$_SESSION['username'] = $_POST['username']; + +header('Location: ' . CONF['common']['prefix'] . '/'); + +success("Compte créé."); diff --git a/public/css/form.css b/public/css/form.css index 40f6837..889170f 100644 --- a/public/css/form.css +++ b/public/css/form.css @@ -35,22 +35,6 @@ input[type=password] { width: 7ch; } -input:invalid+span::after { - content: '✖'; -} - -input:valid+span::after { - content: ''; /* ✓ */ -} - -input+span::after { - display: inline-block; - width: 20px; - font-size: 30px; - padding-left: 20px; - font-family: monospace; -} - :disabled { cursor: not-allowed; } diff --git a/public/ht/https-domain.php b/public/ht/https-domain.php index 4f9efb8..8582465 100644 --- a/public/ht/https-domain.php +++ b/public/ht/https-domain.php @@ -9,7 +9,7 @@

-
+


+
diff --git a/public/ns/mx.php b/public/ns/mx.php index eb0a590..648ed4d 100644 --- a/public/ns/mx.php +++ b/public/ns/mx.php @@ -14,7 +14,7 @@
- +
diff --git a/public/ns/ns.php b/public/ns/ns.php index 0e5776f..450af27 100644 --- a/public/ns/ns.php +++ b/public/ns/ns.php @@ -5,7 +5,7 @@

- +
diff --git a/public/ns/srv.php b/public/ns/srv.php index d414a23..f00a01b 100644 --- a/public/ns/srv.php +++ b/public/ns/srv.php @@ -26,7 +26,7 @@
- +
diff --git a/public/ns/zone.php b/public/ns/zone.php index 7827fb6..e624cee 100644 --- a/public/ns/zone.php +++ b/public/ns/zone.php @@ -3,7 +3,7 @@

Ajouter une zone


-
+
diff --git a/public/reg/glue.php b/public/reg/glue.php index ce12a49..a10cf31 100644 --- a/public/reg/glue.php +++ b/public/reg/glue.php @@ -30,7 +30,7 @@ if (isset($_SESSION['username']))
- +
diff --git a/public/reg/ns.php b/public/reg/ns.php index 4396049..28eb5bb 100644 --- a/public/reg/ns.php +++ b/public/reg/ns.php @@ -21,7 +21,7 @@ if (isset($_SESSION['username']))

- +