Admin Panel Revamp
This commit is contained in:
parent
c99c897561
commit
abb50cf152
11 changed files with 251 additions and 39 deletions
|
@ -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)
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue