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/css/installer.css b/admin/themes/default/css/installer.css index 988fe753..153f0e5f 100644 --- a/admin/themes/default/css/installer.css +++ b/admin/themes/default/css/installer.css @@ -8,6 +8,10 @@ a:hover { text-decoration: none !important; } +p { + margin-bottom: 0; +} + /* ----------- FONTS AWESOME ----------- */ .fa-right { margin-right: 5px; @@ -16,7 +20,7 @@ a:hover { /* ----------- ----------- */ div.main { text-align: center; - margin: 30px 0; + margin: 50px 0 0 0; } h1.title { font-weight: lighter; @@ -27,6 +31,10 @@ td { text-align: center; } +.boxInstallerForm { + margin-top: 30px !important; +} + .tools-message { display: block; position: relative; 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 @@ - + <?php echo $layout['title'] ?> diff --git a/admin/themes/default/login.php b/admin/themes/default/login.php index d4744cd0..e7cf297f 100644 --- a/admin/themes/default/login.php +++ b/admin/themes/default/login.php @@ -2,10 +2,10 @@ - + - Bludit Log in + Bludit @@ -23,7 +23,7 @@ @@ -31,13 +31,13 @@
-
+
'.Alert::get().'
'; + echo '
'.Alert::get().'
'; } // Load view @@ -51,8 +51,6 @@
- - diff --git a/admin/views/dashboard.php b/admin/views/dashboard.php index f76afbb9..9e159b1c 100644 --- a/admin/views/dashboard.php +++ b/admin/views/dashboard.php @@ -50,7 +50,7 @@
-

Drafts

+

p('Drafts') ?>