diff --git a/api/src/controllers/user.js b/api/src/controllers/user.js index fad3bfe97..cff2004db 100644 --- a/api/src/controllers/user.js +++ b/api/src/controllers/user.js @@ -282,7 +282,6 @@ router.post( const { body: { token, password, name }, } = req; - console.log(req.body); if (!validatePassword(password)) return res.status(400).send({ ok: false, error: passwordCheckError, code: PASSWORD_NOT_VALIDATED }); const user = await User.findOne({ where: { forgotPasswordResetToken: token, forgotPasswordResetExpires: { [Op.gte]: new Date() } } }); diff --git a/dashboard/src/scenes/auth/reset.js b/dashboard/src/scenes/auth/reset.js index a84efe45d..9b863d90a 100644 --- a/dashboard/src/scenes/auth/reset.js +++ b/dashboard/src/scenes/auth/reset.js @@ -29,6 +29,7 @@ const Reset = () => { )} { + API.logout(false); return API.post({ path: '/user/forgot_password_reset', body: { diff --git a/dashboard/src/services/api.js b/dashboard/src/services/api.js index 9dd3cf1ff..b9fd31cf4 100644 --- a/dashboard/src/services/api.js +++ b/dashboard/src/services/api.js @@ -136,10 +136,10 @@ const reset = () => { AppSentry.setTag('organisationId', ''); }; -const logout = async () => { +const logout = async (reloadAfterLogout = true) => { await post({ path: '/user/logout' }); reset(); - window.location.reload(); + if (reloadAfterLogout) window.location.reload(); }; // Upload a file to a path.