This commit is contained in:
baoliang 2018-01-29 15:45:42 +08:00
parent f6486bd226
commit fe66922627
3 changed files with 15 additions and 0 deletions

View File

@ -15,3 +15,7 @@ exports.getLast10Metadata = function () {
return db.any('select id, uuid, title, description, ts_created from metadata order by ts_created desc limit 10') return db.any('select id, uuid, title, description, ts_created from metadata order by ts_created desc limit 10')
}; };
exports.login = function(name, password) {
}

View File

@ -6,6 +6,7 @@
"start": "node ./bin/www" "start": "node ./bin/www"
}, },
"dependencies": { "dependencies": {
"bcrypt": "^1.0.3",
"bluebird": "^3.4.7", "bluebird": "^3.4.7",
"body-parser": "~1.15.2", "body-parser": "~1.15.2",
"bootstrap": "^3.3.7", "bootstrap": "^3.3.7",

View File

@ -10,4 +10,14 @@ router.get('/', function (req, res, next) {
}); });
}); });
router.post('/', function(req, res, next) {
if (req.body.username && req.body.username === 'user' && req.body.password && req.body.password === 'pass') {
req.session.authenticated = true;
res.redirect('/secure');
} else {
req.flash('error', 'Username and password are incorrect');
res.redirect('/login');
}
});
module.exports = router; module.exports = router;