mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-09-13 05:47:23 -04:00
fix(auth): validate gcaptcha before password to prevent bypass
Move gcaptcha check before credential validation so a valid captcha is required prior to any login attempt. Previously, password auth ran first, allowing timing-based enumeration without captcha. Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>
This commit is contained in:
1 parent
8e465f9256
commit
5dea748b0c
1 file changed
+7
-7
@@ -39,13 +39,6 @@ class OSPOSRules
|
||||
return false;
|
||||
}
|
||||
|
||||
$password = $data['password'];
|
||||
if (!$employee->login($username, $password)) {
|
||||
$error = lang('Login.invalid_username_and_password');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$gcaptcha_enabled = array_key_exists('gcaptcha_enable', $this->config) && $this->config['gcaptcha_enable'];
|
||||
if ($gcaptcha_enabled) {
|
||||
$g_recaptcha_response = $this->request->getPost('g-recaptcha-response');
|
||||
@@ -57,6 +50,13 @@ class OSPOSRules
|
||||
}
|
||||
}
|
||||
|
||||
$password = $data['password'];
|
||||
if (!$employee->login($username, $password)) {
|
||||
$error = lang('Login.invalid_username_and_password');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user