changed manual comparaisons to

This commit is contained in:
Louis Vallat 2019-11-10 00:17:21 +01:00
parent d0bb2e59b2
commit d175725459
2 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@
$SESSION_COOKIE_NAME = "connection_id"; $SESSION_COOKIE_NAME = "connection_id";
$MAX_COOKIE_LIFE = time() + 86400 * 30; // 30 days max $MAX_COOKIE_LIFE = time() + 86400 * 30; // 30 days max
$MINIMAL_PASSWORD_LENGTH = 8;
$config_array = json_decode(file_get_contents("config.json", true)); $config_array = json_decode(file_get_contents("config.json", true));

View File

@ -29,8 +29,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Validate password // Validate password
if (empty(trim($_POST["password"]))) { if (empty(trim($_POST["password"]))) {
$password_err = "Please enter a password."; $password_err = "Please enter a password.";
} elseif (strlen(trim($_POST["password"])) < 6) { } elseif (strlen(trim($_POST["password"])) < $MINIMAL_PASSWORD_LENGTH) {
$password_err = "Password must have atleast 6 characters."; $password_err = "Password must have atleast $MINIMAL_PASSWORD_LENGTH characters.";
} else { } else {
$password = trim($_POST["password"]); $password = trim($_POST["password"]);
} }