diff --git a/packages/core/src/App/Containers/ResetPasswordModal/reset-password-modal.tsx b/packages/core/src/App/Containers/ResetPasswordModal/reset-password-modal.tsx index c926f2d3ac52..a9868eaf364c 100644 --- a/packages/core/src/App/Containers/ResetPasswordModal/reset-password-modal.tsx +++ b/packages/core/src/App/Containers/ResetPasswordModal/reset-password-modal.tsx @@ -3,10 +3,12 @@ import classNames from 'classnames'; import { Formik, Form, FormikHelpers, FormikErrors } from 'formik'; import { Button, Dialog, PasswordInput, PasswordMeter, Text } from '@deriv/components'; import { redirectToLogin, validPassword, validLength, getErrorMessages, WS, removeActionParam } from '@deriv/shared'; +import { requestOidcAuthentication } from '@deriv-com/auth-client'; import { getLanguage, localize, Localize } from '@deriv/translations'; import { observer, useStore } from '@deriv/stores'; import { TSocketError, TSocketRequest, TSocketResponse } from '@deriv/api/types'; import { useDevice } from '@deriv-com/ui'; +import { useOauth2 } from '@deriv/hooks'; type TResetPasswordModalValues = { password: string; @@ -25,6 +27,8 @@ const ResetPasswordModal = observer(() => { } = ui; const { isDesktop } = useDevice(); + const { isOAuth2Enabled } = useOauth2({ handleLogout: async () => {} }); + const onResetComplete = ( error: TSocketError<'reset_password'>['error'] | null, actions: FormikHelpers @@ -49,7 +53,13 @@ const ResetPasswordModal = observer(() => { setPreventRedirectToHub(false); actions.setStatus({ reset_complete: true }); logoutClient().then(() => { - redirectToLogin(false, getLanguage(), false); + if (isOAuth2Enabled) { + requestOidcAuthentication({ + redirectCallbackUri: `${window.location.origin}/callback`, + }); + } else { + redirectToLogin(false, getLanguage(), false); + } }); };