Skip to content

Commit

Permalink
Backport #5209 - Attempt to Login from Disabled Account
Browse files Browse the repository at this point in the history
Add account disable log message for disabled users attempting to login
  • Loading branch information
TheWitness committed Feb 5, 2023
1 parent dbfe1b0 commit 56d80fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -44,6 +44,7 @@ Cacti CHANGELOG
-issue#5205: Cacti CSS file for Diff.css does look correct in all Cacti Themes
-issue#5207: Deprecated error message during installation routine
-issue#5208: Package form objects use the wrong text domain in their i18n strings
-issue#5209: Add account disable log message for disabled users attempting to login
-issue#5211: Undefined variable $user_id when creating new graph
-issue#5223: Drop callback function sometimes puts name in the form input instead of the id
-issue#5224: When poller run is exceeded by only a short period of time, Cacti does not round the number in the error
Expand Down
19 changes: 13 additions & 6 deletions lib/auth.php
Expand Up @@ -4106,22 +4106,29 @@ function secpass_login_process($username) {
}

if (db_column_exists('user_auth', 'lastfail')) {
$user = db_fetch_row_prepared("SELECT id, username, lastfail, failed_attempts, `locked`, password
$user = db_fetch_row_prepared("SELECT id, username, lastfail, failed_attempts, `locked`, enabled, password
FROM user_auth
WHERE username = ?
AND realm = 0
AND enabled = 'on'",
AND realm = 0",
array($username));
} else {
$user = db_fetch_row_prepared("SELECT id, username, password
$user = db_fetch_row_prepared("SELECT id, username, password, enabled
FROM user_auth
WHERE username = ?
AND realm = 0
AND enabled = 'on'",
AND realm = 0",
array($username));
}

if (cacti_sizeof($user)) {
if ($user['enabled'] != 'on') {
$error = true;
$error_msg = __('Access Denied! Login Failed.');

cacti_log(sprintf('LOGIN FAILED: User %s, account disabled.', $username), false, 'AUTH');

return array();
}

if (trim($password) == '') {
/* error */
$error = true;
Expand Down

0 comments on commit 56d80fe

Please sign in to comment.