Admin Panel Revamp

This commit is contained in:
Wingy 2020-10-29 23:50:36 -04:00
parent c99c897561
commit abb50cf152
11 changed files with 251 additions and 39 deletions

View file

@ -2,10 +2,13 @@ const config = require('../config');
module.exports = options => {
return (req, res, next) => {
options = options ? options : {};
if (req.isAuthenticated()) {
next();
} else {
res.redirect(options.failureRedirect || config.defaultFailureRedirect);
let authed = false
try {
authed = req.isAuthenticated()
} catch {
return res.send('auth fail')
}
if (authed) return next()
res.redirect(options.failureRedirect || config.defaultFailureRedirect)
};
}