summaryrefslogtreecommitdiff
path: root/lib/response.js
diff options
context:
space:
mode:
authorWu Cheng-Han2016-12-15 14:07:12 +0800
committerWu Cheng-Han2016-12-15 14:11:23 +0800
commit5c7eb483198d0d92dc88c7a7c25cca5c23eb5cf2 (patch)
treed848b413c53294bc0e2c3d970e1d9ee54ea50c2d /lib/response.js
parentcf8bae32d162874e4cf4dbd929cc3b9a0383631c (diff)
Add support of allow anonymous config option with correspond modifications
Diffstat (limited to 'lib/response.js')
-rwxr-xr-xlib/response.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/response.js b/lib/response.js
index aae39851..3f837e71 100755
--- a/lib/response.js
+++ b/lib/response.js
@@ -60,6 +60,7 @@ function showIndex(req, res, next) {
res.render(config.indexpath, {
url: config.serverurl,
useCDN: config.usecdn,
+ allowAnonmyous: config.allowanonmyous,
facebook: config.facebook,
twitter: config.twitter,
github: config.github,
@@ -92,6 +93,7 @@ function responseHackMD(res, note) {
url: config.serverurl,
title: title,
useCDN: config.usecdn,
+ allowAnonmyous: config.allowanonmyous,
facebook: config.facebook,
twitter: config.twitter,
github: config.github,
@@ -106,6 +108,8 @@ function newNote(req, res, next) {
var owner = null;
if (req.isAuthenticated()) {
owner = req.user.id;
+ } else if (!config.allowanonmyous) {
+ return response.errorForbidden(res);
}
models.Note.create({
ownerId: owner