mirror of
https://github.com/zadam/trilium.git
synced 2024-12-27 01:34:05 +08:00
22 lines
No EOL
347 B
JavaScript
22 lines
No EOL
347 B
JavaScript
"use strict";
|
|
|
|
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
|
|
}; |