diff --git a/packages/console/src/pages/Profile/containers/ChangePasswordModal/index.tsx b/packages/console/src/pages/Profile/containers/ChangePasswordModal/index.tsx index c812a336e..601f39bbb 100644 --- a/packages/console/src/pages/Profile/containers/ChangePasswordModal/index.tsx +++ b/packages/console/src/pages/Profile/containers/ChangePasswordModal/index.tsx @@ -90,13 +90,7 @@ const ChangePasswordModal = () => { }; return ( - { - navigate('../verify-password', { state }); - }} - > + ( const { id: userId } = ctx.auth; const { password } = ctx.guard.body; - const { isSuspended } = await findUserById(userId); + const { isSuspended, passwordEncrypted: oldPasswordEncrypted } = await findUserById(userId); assertThat(!isSuspended, new RequestError({ code: 'user.suspended', status: 401 })); @@ -142,7 +142,9 @@ export default function userRoutes( assertThat(sessionId, new RequestError({ code: 'session.not_found', status: 401 })); - await checkVerificationStatus(userId, sessionId); + if (oldPasswordEncrypted) { + await checkVerificationStatus(userId, sessionId); + } const { passwordEncrypted, passwordEncryptionMethod } = await encryptUserPassword(password); await updateUserById(userId, { passwordEncrypted, passwordEncryptionMethod });