add simple sanity check for logins

This commit is contained in:
Lorenzo Yario 2025-10-29 16:43:18 -05:00 committed by GitHub
parent 5e472bafac
commit 34e39905f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,6 +57,9 @@ function mod_login(Context $ctx, $redirect = false) {
// Check if inputs are set and not empty
if (!isset($_POST['username'], $_POST['password']) || $_POST['username'] == '' || $_POST['password'] == '') {
$args['error'] = $config['error']['invalid'];
}
elseif (strlen($_POST['password']) > 128 || strlen($_POST['username']) > 128) {
$args['error'] = $config['error']['infotoolong'];
} elseif (!login($_POST['username'], $_POST['password'])) {
if ($config['syslog'])
_syslog(LOG_WARNING, 'Unauthorized login attempt!');