aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/users.js5
1 files changed, 4 insertions, 1 deletions
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) {
71 username: req.body.username, 71 username: req.body.username,
72 password: req.body.password, 72 password: req.body.password,
73 email: req.body.email, 73 email: req.body.email,
74 displayNSFW: false,
74 role: constants.USER_ROLES.USER 75 role: constants.USER_ROLES.USER
75 }) 76 })
76 77
@@ -136,7 +137,9 @@ function updateUser (req, res, next) {
136 db.User.loadByUsername(res.locals.oauth.token.user.username, function (err, user) { 137 db.User.loadByUsername(res.locals.oauth.token.user.username, function (err, user) {
137 if (err) return next(err) 138 if (err) return next(err)
138 139
139 user.password = req.body.password 140 if (req.body.password) user.password = req.body.password
141 if (req.body.displayNSFW !== undefined) user.displayNSFW = req.body.displayNSFW
142
140 user.save().asCallback(function (err) { 143 user.save().asCallback(function (err) {
141 if (err) return next(err) 144 if (err) return next(err)
142 145