mirror of
https://github.com/zadam/trilium.git
synced 2025-06-05 01:18:44 +02:00
fix password protected notes rejection
This commit is contained in:
parent
46deceedc9
commit
e5fdd5128a
1
package-lock.json
generated
1
package-lock.json
generated
@ -5,6 +5,7 @@
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "trilium",
|
||||
"version": "0.53.2",
|
||||
"hasInstallScript": true,
|
||||
"license": "AGPL-3.0-only",
|
||||
|
@ -30,7 +30,7 @@ function addNoIndexHeader(note, res) {
|
||||
}
|
||||
}
|
||||
|
||||
function reject(res) {
|
||||
function requestCredentials(res) {
|
||||
res.setHeader('WWW-Authenticate', 'Basic realm="User Visible Realm", charset="UTF-8"')
|
||||
.sendStatus(401);
|
||||
}
|
||||
@ -55,7 +55,7 @@ function checkNoteAccess(noteId, req, res) {
|
||||
const header = req.header("Authorization");
|
||||
|
||||
if (!header?.startsWith("Basic ")) {
|
||||
reject(res);
|
||||
requestCredentials(res);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -80,6 +80,8 @@ function register(router) {
|
||||
}
|
||||
|
||||
if (!checkNoteAccess(note.noteId, req, res)) {
|
||||
requestCredentials(res);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user