Add a password length check and display an error, if the password is not at least 6 signs.
Add html5 tag "minlength" to password input
This commit is contained in:
Sebastian 2023-01-20 22:26:36 +01:00 committed by GitHub
parent 6cce49f0be
commit 26ac249c9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -295,6 +295,13 @@ function install($adminPassword, $timezone)
date_default_timezone_set('UTC');
}
// Check the length of the password
if (Text::length($adminPassword)<PASSWORD_LENGTH) {
$errorText = sprintf('The password must have a length of minimum %s signs.', PASSWORD_LENGTH);
error_log('[ERROR] ' . $errorText, 0);
redirect(sprintf('install.php?language=%s&error=PASSWORD_LENGTH', $_GET['language'] ?? 'en_EN'));
}
$currentDate = Date::current(DB_DATE_FORMAT);
// Load the examples pages
@ -746,6 +753,11 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
</div>
<div class="form-group mb-0">
<?php if(isset($_GET['error']) && 'PASSWORD_LENGTH' === $_GET['error']) { ?>
<div class="text-danger">
<?php $L->p('The password needs to be contain at least ' . PASSWORD_LENGTH . ' signs') ?>
</div>
<?php } ?>
<input type="password" class="form-control form-control-lg" id="jspassword" name="password" placeholder="<?php $L->p('Password') ?>">
</div>
<div id="jsshowPassword" style="cursor: pointer;" class="text-center pt-0 text-muted"><?php $L->p('Show password') ?></div>