Skip to content

Commit

Permalink
Add security delay on log in failed
Browse files Browse the repository at this point in the history
  • Loading branch information
ganiuszka committed May 7, 2022
1 parent 85063a1 commit 9e66b5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Web/Modules/BaculumWebPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,21 @@ class BaculumWebPage extends BaculumPage {
*/
const DEFAULT_AUTH_USER = 'admin';

/*
* It is security delay that tells how many seconds user needs to wait
* after log in failed error to be able to do next log in try.
* The value is in seconds.
*/
const LOGIN_FAILED_DELAY = 5;

protected $web_config = array();

public function onPreInit($param) {
parent::onPreInit($param);
$this->web_config = $this->getModule('web_config')->getConfig();

if ($this->authenticate() === false) {
sleep(self::LOGIN_FAILED_DELAY);
exit();
}

Expand Down
1 change: 1 addition & 0 deletions Web/Pages/LoginPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public function login($sender, $param) {
if ($success === true) {
$this->goToDefaultPage();
} else {
sleep(BaculumWebPage::LOGIN_FAILED_DELAY);
$this->Msg->Display = 'Fixed';
}
}
Expand Down

0 comments on commit 9e66b5c

Please sign in to comment.