extra init check to provide better error response

This commit is contained in:
zadam 2021-11-10 21:12:53 +01:00
parent 550a9fa711
commit 5710c9e997

View file

@ -79,8 +79,12 @@ function reject(req, res, message) {
}
function checkCredentials(req, res, next) {
if (!sqlInit.isDbInitialized()) {
res.status(400).send('Database is not initialized yet.');
}
const header = req.headers['trilium-cred'] || '';
const auth = new Buffer.from(header, 'base64').toString();console.log("auth", auth);
const auth = new Buffer.from(header, 'base64').toString();
const [username, password] = auth.split(/:/);
const dbUsername = optionService.getOption('username');