Added express-brute-loki, UI improvements, error page

This commit is contained in:
NGPixel 2016-08-23 00:25:36 -04:00
parent 24f90d4a17
commit aa740dea7a
10 changed files with 105 additions and 30 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
@import './layout/_fonts';
//@import './layout/_fonts';
@import './layout/_base';
$warning: #f68b39;

View File

@ -5,4 +5,5 @@ html {
box-sizing: inherit;
}
$family-sans-serif: "Roboto", "Helvetica", "Arial", sans-serif;
//$family-sans-serif: "Roboto", "Helvetica", "Arial", sans-serif;
$family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";

View File

@ -1,4 +1,11 @@
.sd-menus {
width: 300px;
}
.mkcontent {
h1 {
@ -12,13 +19,21 @@
font-size: 80%;
color: $purple;
border-bottom: none;
&:visited {
color: $purple !important;
}
}
.hljs {
padding: 0;
border-bottom: 1px solid $grey-light;
border-right: 1px solid $grey-light;
border-radius: 3px;
> code {
box-shadow: inset 0 0 5px 0 $grey-light;
}
}
pre + p {
@ -29,4 +44,40 @@
float:right;
}
img.pagelogo {
float: right;
margin-top: -50px;
max-width: 200px;
}
strong {
color: $grey-dark;
}
}
.content a:not(.button):visited {
color: $turquoise;
font-weight: 500;
}
code {
font-weight: 500;
color: $purple;
}
p code {
padding: 2px 5px;
border-radius: 4px;
}
.card-header {
background-color: $turquoise;
}
.card-header-title {
color: #FFF;
font-weight: 400;
font-size: 16px;
padding: 10px 20px;
}

View File

@ -2,15 +2,14 @@ var express = require('express');
var router = express.Router();
var passport = require('passport');
var ExpressBrute = require('express-brute');
//var ExpressBruteRedisStore = require('express-brute-redis');
var ExpressBruteLokiStore = require('D:\\git\\express-brute-loki');
var moment = require('moment');
/**
* Setup Express-Brute
*/
/*var EBstore = new ExpressBruteRedisStore({
prefix: 'bf:',
client: red
var EBstore = new ExpressBruteLokiStore({
path: './data/brute.db'
});
var bruteforce = new ExpressBrute(EBstore, {
freeRetries: 5,
@ -26,7 +25,7 @@ var bruteforce = new ExpressBrute(EBstore, {
});
res.redirect('/login');
}
});*/
});
/**
* Login form
@ -37,7 +36,7 @@ router.get('/login', function(req, res, next) {
});
});
router.post('/login', /*bruteforce.prevent,*/ function(req, res, next) {
router.post('/login', bruteforce.prevent, function(req, res, next) {
passport.authenticate('local', function(err, user, info) {
if (err) { return next(err); }
@ -54,9 +53,9 @@ router.post('/login', /*bruteforce.prevent,*/ function(req, res, next) {
req.logIn(user, function(err) {
if (err) { return next(err); }
//req.brute.reset(function () {
return res.redirect('/');
//});
req.brute.reset(function () {
return res.redirect('/');
});
});
})(req, res, next);

View File

@ -11,10 +11,11 @@ router.get('/', (req, res) => {
var Promise = require('bluebird');
var fs = Promise.promisifyAll(require("fs"));
fs.readFileAsync("repo/Home.md", "utf8").then(function(contents) {
fs.readFileAsync("repo/Storage/Redis.md", "utf8").then(function(contents) {
let pageData = mark.parse(contents);
if(!pageData.title) {
pageData.title = 'Gollum';
pageData.title = 'Redis';
pageData.subtitle = 'An open source, in-memory data structure store, used as database, cache and message broker.'
}
res.render('pages/view', { pageData });
});

View File

@ -38,7 +38,7 @@
"cheerio": "^0.20.0",
"compression": "^1.6.2",
"connect-flash": "^0.1.1",
"connect-loki": "^1.0.4",
"connect-loki": "^1.0.5",
"connect-redis": "^3.1.0",
"cookie-parser": "^1.4.3",
"express": "^4.14.0",
@ -102,7 +102,7 @@
"mocha": "^3.0.2",
"mocha-lcov-reporter": "^1.2.0",
"nodemon": "^1.10.2",
"snyk": "^1.18.0",
"snyk": "^1.18.1",
"vue": "^1.0.26"
}
}

View File

@ -6,11 +6,8 @@ nav.nav.has-shadow.stickyscroll
a.nav-item(href='/')
h1.title Wiki
.nav-center
p.nav-item.control.has-addons
input.input(type='text', placeholder='Find...')
a.button.is-info
span.icon.is-small
i.fa.fa-search
p.nav-item
input.input(type='text', placeholder='Search...', style= { 'max-width': '300px', width: '33vw' })
span.nav-toggle
span
span
@ -25,7 +22,7 @@ nav.nav.has-shadow.stickyscroll
span.icon
i.fa.fa-edit
span Edit
a.button.is-primary(href='#')
a.button.is-primary(href='#', onclick='$(".modal").addClass("is-active");')
span.icon
i.fa.fa-plus
span Create

View File

@ -14,8 +14,17 @@ html
link(type='text/css', rel='stylesheet', href='/css/app.css')
body(class='server-error')
#root
img(src='/images/logo-text_218x80.png')
h1 Oops, something went wrong
h4= message
pre #{error.stack}
section.hero.is-warning.is-fullheight
.hero-body
.container
a(href='/'): img(src='/favicons/android-icon-96x96.png')
h1.title(style={ 'margin-top': '30px'})= message
h2.subtitle(style={ 'margin-bottom': '50px'}) Oops, something went wrong
a.button.is-warning.is-inverted(href='/') Go Home
if error.stack
section.section
.container.is-fluid
.content
h3 Detailed debug trail:
pre: code #{error.stack}

View File

@ -14,7 +14,7 @@ block content
.container.is-fluid
.columns
.column.is-narrow
.column.is-narrow.sd-menus.is-hidden-touch
.box
aside.menu(style= { 'min-width': '200px' })
@ -23,6 +23,8 @@ block content
ul.menu-list
li
a(href='/') Home
li
a(href='/') Storage
li
a(href='/account') Account
.box.stickyscroll(data-margin-top=70)
@ -41,3 +43,18 @@ block content
.content.mkcontent
!= pageData.html
.modal
.modal-background
.modal-container
.modal-content
.card.is-fullwidth
header.card-header
p.card-header-title Create New Page
.card-content
.content
label.label Enter the full path:
p.control
input.input(type='text', placeholder='/path', value='/storage/new-page')
footer.card-footer
a.card-footer-item(onclick='$(".modal").removeClass("is-active");') Discard
a.card-footer-item Create