mirror of
https://github.com/zadam/trilium.git
synced 2024-11-15 12:17:01 +08:00
20 lines
332 B
JavaScript
20 lines
332 B
JavaScript
|
function checkAuth(req, res, next) {
|
||
|
if (!req.session.loggedIn) {
|
||
|
res.redirect("login");
|
||
|
} else {
|
||
|
next();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function checkApiAuth(req, res, next) {
|
||
|
if (!req.session.loggedIn) {
|
||
|
res.sendStatus(401);
|
||
|
} else {
|
||
|
next();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
checkAuth,
|
||
|
checkApiAuth
|
||
|
};
|