From 947d2a59270bdbfc0f2bcdc8253eb3affbfd58b3 Mon Sep 17 00:00:00 2001 From: Arnaud AMBROSELLI Date: Mon, 16 Oct 2023 17:06:23 +0200 Subject: [PATCH] =?UTF-8?q?fix(api,dashboard):=20d=C3=A9connecte=20avant?= =?UTF-8?q?=20de=20changer=20un=20mot=20de=20passe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/src/controllers/user.js | 1 - dashboard/src/scenes/auth/reset.js | 1 + dashboard/src/services/api.js | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) 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.