mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
set password WIP
This commit is contained in:
@@ -15,7 +15,11 @@ function checkAuth(req, res, next) {
|
||||
res.redirect("setup");
|
||||
}
|
||||
else if (!req.session.loggedIn && !utils.isElectron() && !noAuthentication) {
|
||||
res.redirect("login");
|
||||
if (sqlInit.isPasswordSet()) {
|
||||
res.redirect("login");
|
||||
} else {
|
||||
res.redirect("set_password");
|
||||
}
|
||||
}
|
||||
else {
|
||||
next();
|
||||
@@ -51,6 +55,14 @@ function checkAppInitialized(req, res, next) {
|
||||
}
|
||||
}
|
||||
|
||||
function checkPasswordSet(req, res, next) {
|
||||
if (!utils.isElectron() && !sqlInit.isPasswordSet()) {
|
||||
res.redirect("set_password");
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
function checkAppNotInitialized(req, res, next) {
|
||||
if (sqlInit.isDbInitialized()) {
|
||||
reject(req, res, "App already initialized.");
|
||||
@@ -101,6 +113,7 @@ module.exports = {
|
||||
checkAuth,
|
||||
checkApiAuth,
|
||||
checkAppInitialized,
|
||||
checkPasswordSet,
|
||||
checkAppNotInitialized,
|
||||
checkApiAuthOrElectron,
|
||||
checkToken,
|
||||
|
||||
Reference in New Issue
Block a user