Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-mw committed Jul 11, 2022
1 parent d56781e commit 53c000c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/MicroweberPackages/User/UserManager.php
Expand Up @@ -188,6 +188,18 @@ public function login($params)
return array('error' => 'There are ' . $check2 . ' failed login attempts from your IP in the last 10 minutes. You are blocked for 10 minutes!');
}



// third check by server REMOTE_ADDR , if the an atacker spoofs the user headers such as HTTP_X_FORWARDED or HTTP_CLIENT_IP
if (isset($_SERVER['REMOTE_ADDR'])) {
$check3 = $this->app->log_manager->get('no_cache=1&is_system=y&count=1&created_at=[mt]15 min ago&updated_at=[lt]15 min&rel_type=login_failed&user_ip=' . $_SERVER['REMOTE_ADDR']);
if ($check3 > 25) {
return array('error' => 'There are ' . $check3 . ' failed login attempts from your IP in the last 15 minutes. You are blocked for 15 minutes!');
}
}



if (isset($params['code_login'])) {
return $this->codeLogin($params['code_login']);
}
Expand Down

0 comments on commit 53c000c

Please sign in to comment.