From 1d49e1e27d63db1dfc9a7fd28c9902f488831a89 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 3 Apr 2017 21:24:36 +0200 Subject: Server: Add NSFW in user profile --- server/controllers/api/users.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/users.js b/server/controllers/api/users.js index f854b3082..6b6c0774f 100644 --- a/server/controllers/api/users.js +++ b/server/controllers/api/users.js @@ -71,6 +71,7 @@ function createUser (req, res, next) { username: req.body.username, password: req.body.password, email: req.body.email, + displayNSFW: false, role: constants.USER_ROLES.USER }) @@ -136,7 +137,9 @@ function updateUser (req, res, next) { db.User.loadByUsername(res.locals.oauth.token.user.username, function (err, user) { if (err) return next(err) - user.password = req.body.password + if (req.body.password) user.password = req.body.password + if (req.body.displayNSFW !== undefined) user.displayNSFW = req.body.displayNSFW + user.save().asCallback(function (err) { if (err) return next(err) -- cgit v1.2.3