From f321b426b1ac0650cb015690ebffcacc31fa106a Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 24 May 2019 11:23:55 -0400 Subject: [PATCH] fix: 7638, returnTo accidentally saved into user hash --- src/controllers/authentication.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js index 41d1316852..2d5ed688db 100644 --- a/src/controllers/authentication.js +++ b/src/controllers/authentication.js @@ -9,7 +9,7 @@ var _ = require('lodash'); var db = require('../database'); var meta = require('../meta'); -var user = require('../user'); +var user = require('../user').async; var plugins = require('../plugins'); var utils = require('../utils'); var translator = require('../translator'); @@ -180,7 +180,7 @@ authenticationController.registerComplete = function (req, res, next) { } }; - async.parallel(callbacks, function (_blank, err) { + async.parallel(callbacks, async function (_blank, err) { if (err.length) { err = err.filter(Boolean).map(function (err) { return err.message; @@ -200,6 +200,7 @@ authenticationController.registerComplete = function (req, res, next) { const payload = req.session.registration; const uid = payload.uid; delete payload.uid; + delete payload.returnTo; Object.keys(payload).forEach((prop) => { if (typeof payload[prop] === 'boolean') { @@ -207,7 +208,8 @@ authenticationController.registerComplete = function (req, res, next) { } }); - user.setUserFields(uid, payload, done); + await user.setUserFields(uid, payload); + done(); } }); });