Skip to content

Commit

Permalink
Merge pull request #474 from etn-ccis/feature/4709-move-existing-acou…
Browse files Browse the repository at this point in the history
…nt-success-screen-to-on-load

Moved existing acount success logic on load for invite registration
  • Loading branch information
surajeaton authored Sep 13, 2023
2 parents 78b2302 + 3398d2e commit a30a2b8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const ChangePasswordDialog: React.FC<ChangePasswordDialogProps> = (props)
previousLabel = t('bluiCommon:ACTIONS.BACK'),
nextLabel = t('bluiCommon:ACTIONS.OKAY'),
onPrevious,
onSubmit,
onFinish,
PasswordProps,
ErrorDialogProps,
Expand Down Expand Up @@ -88,7 +87,6 @@ export const ChangePasswordDialog: React.FC<ChangePasswordDialogProps> = (props)
actions,
setIsLoading,
setShowErrorDialog,
onSubmit,
onFinish,
props.showSuccessScreen,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,18 @@ export const RegistrationWorkflow: React.FC<React.PropsWithChildren<Registration
if (isInviteRegistration) {
const params = parseQueryString(window.location.search);

let isAccExist;
void (async (): Promise<void> => {
try {
isAccExist = await actions.validateUserRegistrationRequest(params.code, params.email);
} catch (_error) {
triggerError(_error as Error);
} finally {
setIsAccountExist(isAccExist);
setShowSuccessScreen(isAccExist);
}
})();

updateScreenData({ screenId: 'CreateAccount', values: { emailAddress: params.email } });
updateScreenData({ screenId: 'VerifyCode', values: { code: params.code } });
}
Expand Down
12 changes: 2 additions & 10 deletions login-workflow/src/screens/EulaScreen/EulaScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const EulaScreen: React.FC<EulaScreenProps> = (props) => {
},
};
const regWorkflow = useRegistrationWorkflowContext();
const { nextScreen, previousScreen, screenData, currentScreen, totalScreens, isInviteRegistration } = regWorkflow;
const { nextScreen, previousScreen, screenData, currentScreen, totalScreens } = regWorkflow;
const {
WorkflowCardHeaderProps,
WorkflowCardActionsProps,
Expand Down Expand Up @@ -79,24 +79,16 @@ export const EulaScreen: React.FC<EulaScreenProps> = (props) => {
if (screenData.Eula.accepted) {
await actions.acceptEula?.();
}
let isAccExist;
if (isInviteRegistration) {
isAccExist = await actions.validateUserRegistrationRequest(
screenData.VerifyCode.code,
screenData.CreateAccount.emailAddress
);
}
void nextScreen({
screenId: 'Eula',
values: { accepted: screenData.Eula.accepted },
isAccountExist: isAccExist,
});
} catch (_error) {
triggerError(_error as Error);
} finally {
setIsLoading(false);
}
}, [actions, nextScreen, triggerError, isInviteRegistration, screenData]);
}, [actions, nextScreen, triggerError, screenData]);

const onPrevious = useCallback((): void => {
setIsLoading(true);
Expand Down

0 comments on commit a30a2b8

Please sign in to comment.