diff --git a/admin/controllers/login.php b/admin/controllers/login.php
index 60227b2e..d9ee03fe 100644
--- a/admin/controllers/login.php
+++ b/admin/controllers/login.php
@@ -8,6 +8,31 @@
// Functions
// ============================================================================
+function checkPost($args)
+{
+ global $Security;
+ global $Login;
+ global $Language;
+
+ if($Security->isBlocked()) {
+ Alert::set($Language->g('IP address has been blocked').'
'.$Language->g('Try again in a few minutes'));
+ return false;
+ }
+
+ // Verify User sanitize the input
+ if( $Login->verifyUser($_POST['username'], $_POST['password']) )
+ {
+ Redirect::page('admin', 'dashboard');
+ return true;
+ }
+
+ // Bruteforce protection, add IP to blacklist.
+ $Security->addLoginFail();
+ Alert::set($Language->g('Username or password incorrect'));
+
+ return false;
+}
+
// ============================================================================
// Main before POST
// ============================================================================
@@ -18,15 +43,7 @@
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
- // Verify User sanitize the input
- if( $Login->verifyUser($_POST['username'], $_POST['password']) )
- {
- Redirect::page('admin', 'dashboard');
- }
- else
- {
- Alert::set($Language->g('Username or password incorrect'));
- }
+ checkPost($_POST);
}
// ============================================================================
diff --git a/admin/themes/default/css/default.css b/admin/themes/default/css/default.css
index b375a66d..5246859e 100644
--- a/admin/themes/default/css/default.css
+++ b/admin/themes/default/css/default.css
@@ -16,6 +16,10 @@ div.unit-80 {
margin-left: 1% !important;
}
+.tools-alert {
+ text-align: center;
+}
+
/* ----------- FONTS AWESOME ----------- */
.fa-right {
margin-right: 5px;
diff --git a/admin/themes/default/index.php b/admin/themes/default/index.php
index 02113bb6..c6738ce8 100644
--- a/admin/themes/default/index.php
+++ b/admin/themes/default/index.php
@@ -2,7 +2,7 @@