Fix audit source usage

This commit is contained in:
Johannes Zellner
2020-02-05 16:12:40 +01:00
parent 1fbbaa82ab
commit 1f41e6dc0f

View File

@@ -136,7 +136,7 @@ function setupAccount(req, res, next) {
users.getByResetToken(req.body.resetToken, function (error, userObject) {
if (error) return next(new HttpError(401, 'Invalid Reset Token'));
users.update(userObject.id, { username: req.body.username, displayName: req.body.displayName }, auditSource(req), function (error) {
users.update(userObject.id, { username: req.body.username, displayName: req.body.displayName }, auditSource.fromRequest(req), function (error) {
if (error && error.reason === BoxError.ALREADY_EXISTS) return next(new HttpError(409, 'Username already used'));
if (error && error.reason === BoxError.BAD_FIELD) return next(new HttpError(400, error.message));
if (error && error.reason === BoxError.NOT_FOUND) return next(new HttpError(404, 'No such user'));