summaryrefslogtreecommitdiff
path: root/lib/response.js
diff options
context:
space:
mode:
authorMax Wu2017-01-10 20:23:47 +0800
committerGitHub2017-01-10 20:23:47 +0800
commita8068d38d589a1b8ed008f737d42ed35df4bfd2b (patch)
tree0f3b5fcdaa9da239170dd7a6731d0f8f0504f759 /lib/response.js
parent258a59a77d390196a66acfbd5dd49ea66c5f18f9 (diff)
parentd6be0cf755e31002d6265b706785c06e06a0ae56 (diff)
Merge pull request #313 from elct9620/feature/disable_anonymous_view
WIP: Add options to limit anonymous view note
Diffstat (limited to 'lib/response.js')
-rwxr-xr-xlib/response.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/response.js b/lib/response.js
index cedee3de..6c1db967 100755
--- a/lib/response.js
+++ b/lib/response.js
@@ -124,6 +124,11 @@ function checkViewPermission(req, note) {
return false;
else
return true;
+ } else if (note.permission == 'limited' || note.permission == 'protected') {
+ if( !req.isAuthenticated() ) {
+ return false;
+ }
+ return true;
} else {
return true;
}
@@ -163,7 +168,7 @@ function showNote(req, res, next) {
findNote(req, res, function (note) {
// force to use note id
var noteId = req.params.noteId;
- var id = LZString.compressToBase64(note.id);
+ var id = LZString.compressToBase64(note.id);
if ((note.alias && noteId != note.alias) || (!note.alias && noteId != id))
return res.redirect(config.serverurl + "/" + (note.alias || id));
return responseHackMD(res, note);
@@ -415,7 +420,7 @@ function publishSlideActions(req, res, next) {
res.redirect(config.serverurl + '/' + (note.alias ? note.alias : LZString.compressToBase64(note.id)));
break;
default:
- res.redirect(config.serverurl + '/p/' + note.shortid);
+ res.redirect(config.serverurl + '/p/' + note.shortid);
break;
}
});