mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
reorganization of source code
This commit is contained in:
20
services/auth.js
Normal file
20
services/auth.js
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
};
|
||||
Reference in New Issue
Block a user