user: load the resource with middleware
This commit is contained in:
@@ -53,7 +53,7 @@ function update(req, res, next) {
|
||||
|
||||
var data = _.pick(req.body, 'email', 'fallbackEmail', 'displayName');
|
||||
|
||||
users.update(req.user.id, data, auditSource.fromRequest(req), function (error) {
|
||||
users.update(req.user, data, auditSource.fromRequest(req), function (error) {
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(204));
|
||||
@@ -88,7 +88,7 @@ function changePassword(req, res, next) {
|
||||
|
||||
if (typeof req.body.newPassword !== 'string') return next(new HttpError(400, 'newPassword must be a string'));
|
||||
|
||||
users.setPassword(req.user.id, req.body.newPassword, function (error) {
|
||||
users.setPassword(req.user, req.body.newPassword, function (error) {
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(204));
|
||||
|
||||
Reference in New Issue
Block a user