mirror of
https://github.com/zadam/trilium.git
synced 2024-11-10 17:13:45 +08:00
fix password protected notes rejection
This commit is contained in:
parent
46deceedc9
commit
e5fdd5128a
2 changed files with 5 additions and 2 deletions
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…
Reference in a new issue