From d175725459fca4e96a8fa7f2441c0f7554f1c002 Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Sun, 10 Nov 2019 00:17:21 +0100 Subject: [PATCH] changed manual comparaisons to --- assets/php/utils.php | 1 + register.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/php/utils.php b/assets/php/utils.php index 42d24db..62a80bb 100644 --- a/assets/php/utils.php +++ b/assets/php/utils.php @@ -2,6 +2,7 @@ $SESSION_COOKIE_NAME = "connection_id"; $MAX_COOKIE_LIFE = time() + 86400 * 30; // 30 days max +$MINIMAL_PASSWORD_LENGTH = 8; $config_array = json_decode(file_get_contents("config.json", true)); diff --git a/register.php b/register.php index ff2529a..efd650b 100644 --- a/register.php +++ b/register.php @@ -29,8 +29,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { // Validate password if (empty(trim($_POST["password"]))) { $password_err = "Please enter a password."; - } elseif (strlen(trim($_POST["password"])) < 6) { - $password_err = "Password must have atleast 6 characters."; + } elseif (strlen(trim($_POST["password"])) < $MINIMAL_PASSWORD_LENGTH) { + $password_err = "Password must have atleast $MINIMAL_PASSWORD_LENGTH characters."; } else { $password = trim($_POST["password"]); }