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;
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;
}
@ -33,7 +33,7 @@ function checkLogin($args)
$Security->addToBlacklist();
// Create alert
Alert::set($Language->g('Username or password incorrect'));
Alert::set($Language->g('Username or password incorrect'), ALERT_STATUS_FAIL);
return false;
}

View File

@ -1,6 +1,7 @@
html {
font-size: 0.9em;
height: 100%;
}
/*
@ -35,6 +36,16 @@ a:hover {
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
*/
@ -83,11 +94,22 @@ a:hover {
*/
#alert {
display: none;
position: absolute;
right: 0px;
padding: 16px 90px;
position: fixed;
text-align: center;
border-radius: 0px;
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">
<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 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>
</li>
@ -43,4 +44,8 @@
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><?php $L->p('About') ?></a>
</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>

View File

@ -1,45 +1,61 @@
<!DOCTYPE HTML>
<html class="uk-height-1-1 uk-notouch">
<!DOCTYPE html>
<html>
<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>
<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 -->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_ADMIN_THEME.'img/favicon.png?version='.BLUDIT_VERSION ?>">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/uikit.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/login.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_CORE_CSS.'font-awesome/css/font-awesome.min.css?version='.BLUDIT_VERSION ?>">
<?php
echo Bootstrap::css(array(
'bootstrap.min.css',
'jquery-auto-complete.css',
'open-iconic-master/font/css/open-iconic-bootstrap.min.css',
'bludit.css'
));
?>
<!-- Javascript -->
<script charset="utf-8" src="<?php echo HTML_PATH_CORE_JS.'jquery.min.js?version='.BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/uikit/uikit.min.js?version='.BLUDIT_VERSION ?>"></script>
<?php
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 -->
<?php Theme::plugins('loginHead') ?>
</head>
<body class="uk-height-1-1">
<body class="login">
<!-- Plugins -->
<?php Theme::plugins('loginBodyBegin') ?>
<div class="uk-vertical-align uk-text-center uk-height-1-1">
<div class="uk-vertical-align-middle login-box">
<h1>BLUDIT</h1>
<?php
if (Alert::defined()) {
echo '<div class="uk-alert uk-alert-danger">'.Alert::get().'</div>';
}
<!-- Alert -->
<?php include('html/alert.php'); ?>
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
}
?>
</div>
<div class="container">
<div class="row justify-content-md-center pt-5">
<div class="col-4 pt-5">
<?php
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
}
?>
</div>
</div>
</div>
<!-- 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">
<input name="username" class="uk-width-1-1 uk-form-large" placeholder="<?php $L->p('Username') ?>" type="text">
echo Bootstrap::formInputHidden(array(
'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 class="uk-form-row">
<input name="password" class="uk-width-1-1 uk-form-large" placeholder="<?php $L->p('Password') ?>" type="password">
<div class="form-group mt-4">
<button type="submit" class="btn btn-primary mr-2 w-100 text-" name="save">'.$L->g('Login').'</button>
</div>
';
<div class="uk-form-row">
<label><input type="checkbox" name="remember"> <?php $L->p('Remember me') ?></label>
</div>
echo Bootstrap::formClose();
<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();
}
// Slug from title or content
// Slug from the title or the content
if (empty($args['slug'])) {
if (!empty($args['title'])) {
$args['slug'] = $this->generateSlug($args['title']);