Skip to content

Commit

Permalink
chore: remove redirection to login auth for reset password if auth en…
Browse files Browse the repository at this point in the history
…abled (#18029)
  • Loading branch information
adrienne-deriv authored Jan 24, 2025
1 parent 23c89aa commit 71f81f4
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<TResetPasswordModalValues>
Expand All @@ -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);
}
});
};

Expand Down

0 comments on commit 71f81f4

Please sign in to comment.