Login frontend

This commit is contained in:
Diego Najar 2018-06-05 23:50:03 +02:00
parent 6157ed5cba
commit 2eb8a4bfac
6 changed files with 102 additions and 47 deletions

View File

@ -15,7 +15,7 @@ function checkLogin($args)
global $Language; global $Language;
if ($Security->isBlocked()) { if ($Security->isBlocked()) {
Alert::set($Language->g('IP address has been blocked').'<br>'.$Language->g('Try again in a few minutes')); Alert::set($Language->g('IP address has been blocked').'<br>'.$Language->g('Try again in a few minutes'), ALERT_STATUS_FAIL);
return false; return false;
} }
@ -33,7 +33,7 @@ function checkLogin($args)
$Security->addToBlacklist(); $Security->addToBlacklist();
// Create alert // Create alert
Alert::set($Language->g('Username or password incorrect')); Alert::set($Language->g('Username or password incorrect'), ALERT_STATUS_FAIL);
return false; return false;
} }

View File

@ -1,6 +1,7 @@
html { html {
font-size: 0.9em; font-size: 0.9em;
height: 100%;
} }
/* /*
@ -35,6 +36,16 @@ a:hover {
border-color: #4a90e2; border-color: #4a90e2;
} }
/*
LOGIN
*/
body.login {
background: rgb(255,255,255);
background: linear-gradient(0deg, rgba(255,255,255,1) 0%, rgba(250,250,250,1) 53%);
height: 100%;
}
/* /*
DASHBOARD DASHBOARD
*/ */
@ -83,11 +94,22 @@ a:hover {
*/ */
#alert { #alert {
display: none; display: none;
position: absolute; position: fixed;
right: 0px; text-align: center;
padding: 16px 90px;
border-radius: 0px; border-radius: 0px;
border: 0; border: 0;
z-index: 1000;
width: 100%;
}
.alert-success {
background-color: #4586d4;
color: #ffffff;
}
.alert-danger {
background-color: #d44545;
color: #ffffff;
} }
/* /*

View File

@ -11,6 +11,7 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" target="_blank" href="<?php echo HTML_PATH_ROOT ?>"><span class="oi oi-external-link"></span><?php $L->p('Website') ?></a> <a class="nav-link" target="_blank" href="<?php echo HTML_PATH_ROOT ?>"><span class="oi oi-external-link"></span><?php $L->p('Website') ?></a>
</li> </li>
<li class="nav-item mt-3"> <li class="nav-item mt-3">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>"><span class="oi oi-plus"></span><?php $L->p('New content') ?></a> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>"><span class="oi oi-plus"></span><?php $L->p('New content') ?></a>
</li> </li>
@ -43,4 +44,8 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><?php $L->p('About') ?></a> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><?php $L->p('About') ?></a>
</li> </li>
<li class="nav-item mt-5">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'logout' ?>"><span class="oi oi-account-logout"></span><?php $L->p('Logout') ?></a>
</li>
</ul> </ul>

View File

@ -1,45 +1,61 @@
<!DOCTYPE HTML> <!DOCTYPE html>
<html class="uk-height-1-1 uk-notouch"> <html>
<head> <head>
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex,nofollow">
<title>Bludit</title> <title>Bludit</title>
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="robots" content="noindex,nofollow">
<!-- Favicon --> <!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_ADMIN_THEME.'img/favicon.png?version='.BLUDIT_VERSION ?>"> <link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_ADMIN_THEME.'img/favicon.png?version='.BLUDIT_VERSION ?>">
<!-- CSS --> <!-- CSS -->
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/uikit.almost-flat.min.css?version='.BLUDIT_VERSION ?>"> <?php
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/login.css?version='.BLUDIT_VERSION ?>"> echo Bootstrap::css(array(
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_CORE_CSS.'font-awesome/css/font-awesome.min.css?version='.BLUDIT_VERSION ?>"> 'bootstrap.min.css',
'jquery-auto-complete.css',
'open-iconic-master/font/css/open-iconic-bootstrap.min.css',
'bludit.css'
));
?>
<!-- Javascript --> <!-- Javascript -->
<script charset="utf-8" src="<?php echo HTML_PATH_CORE_JS.'jquery.min.js?version='.BLUDIT_VERSION ?>"></script> <?php
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/uikit/uikit.min.js?version='.BLUDIT_VERSION ?>"></script> echo Bootstrap::js(array(
'jquery.min.js',
'jquery-auto-complete.min.js',
'bootstrap-bundle.min.js'
));
?>
<!-- Javascript -->
<?php
echo '<script>';
include(PATH_CORE_JS.'bludit-ajax.php');
echo '</script>';
?>
<!-- Plugins --> <!-- Plugins -->
<?php Theme::plugins('loginHead') ?> <?php Theme::plugins('loginHead') ?>
</head> </head>
<body class="uk-height-1-1"> <body class="login">
<!-- Plugins --> <!-- Plugins -->
<?php Theme::plugins('loginBodyBegin') ?> <?php Theme::plugins('loginBodyBegin') ?>
<div class="uk-vertical-align uk-text-center uk-height-1-1"> <!-- Alert -->
<div class="uk-vertical-align-middle login-box"> <?php include('html/alert.php'); ?>
<h1>BLUDIT</h1>
<?php
if (Alert::defined()) {
echo '<div class="uk-alert uk-alert-danger">'.Alert::get().'</div>';
}
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) { <div class="container">
include(PATH_ADMIN_VIEWS.$layout['view'].'.php'); <div class="row justify-content-md-center pt-5">
} <div class="col-4 pt-5">
?> <?php
</div> if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
}
?>
</div>
</div>
</div> </div>
<!-- Plugins --> <!-- Plugins -->

View File

@ -1,25 +1,37 @@
<div class="login-form"> <?php defined('BLUDIT') or die('Bludit CMS.');
<form method="post" action="" class="uk-form" autocomplete="off"> echo '<h1 class="text-center mb-5 mt-5 font-weight-normal" style="color: #555;">BLUDIT</h1>';
<input type="hidden" id="jstoken" name="tokenCSRF" value="<?php echo $Security->getTokenCSRF() ?>"> echo Bootstrap::formOpen(array());
<div class="uk-form-row"> echo Bootstrap::formInputHidden(array(
<input name="username" class="uk-width-1-1 uk-form-large" placeholder="<?php $L->p('Username') ?>" type="text"> 'name'=>'tokenCSRF',
'value'=>$Security->getTokenCSRF()
));
echo '
<div class="form-group">
<input type="text" value="'.(isset($_POST['username'])?$_POST['username']:'').'" class="form-control form-control-lg" id="jsusername" name="username" placeholder="'.$L->g('Username').'">
</div>
';
echo '
<div class="form-group">
<input type="password" class="form-control form-control-lg" id="jspassword" name="password" placeholder="'.$L->g('Password').'">
</div>
';
echo '
<div class="form-check">
<input class="form-check-input" type="checkbox" value="true" id="jsremember" name="remember">
<label class="form-check-label" for="jsremember">'.$L->g('Remember me').'</label>
</div> </div>
<div class="uk-form-row"> <div class="form-group mt-4">
<input name="password" class="uk-width-1-1 uk-form-large" placeholder="<?php $L->p('Password') ?>" type="password"> <button type="submit" class="btn btn-primary mr-2 w-100 text-" name="save">'.$L->g('Login').'</button>
</div> </div>
';
<div class="uk-form-row"> echo Bootstrap::formClose();
<label><input type="checkbox" name="remember"> <?php $L->p('Remember me') ?></label>
</div>
<div class="uk-form-row"> ?>
<button type="submit" class="uk-width-1-1 uk-button uk-button-primary uk-button-large"><?php $Language->p('Login') ?></button>
</div>
</form>
</div>

View File

@ -59,7 +59,7 @@ class dbPages extends dbJSON
$args['tags'] = array(); $args['tags'] = array();
} }
// Slug from title or content // Slug from the title or the content
if (empty($args['slug'])) { if (empty($args['slug'])) {
if (!empty($args['title'])) { if (!empty($args['title'])) {
$args['slug'] = $this->generateSlug($args['title']); $args['slug'] = $this->generateSlug($args['title']);