fix(striker-ui): make confirm password always required in general init form

main
Tsu-ba-me 9 months ago
parent c22bc3ed29
commit 48aa219d35
  1. 30
      striker-ui/components/GeneralInitForm.tsx

@ -116,8 +116,6 @@ const GeneralInitForm = forwardRef<
] = useState<boolean>(false);
const [isShowHostNameSuggest, setIsShowHostNameSuggest] =
useState<boolean>(false);
const [isConfirmAdminPassword, setIsConfirmAdminPassword] =
useState<boolean>(true);
const [isValidateDomain, setIsValidateDomain] = useState<boolean>(true);
const readHostDetailRef = useRef<boolean>(true);
@ -378,17 +376,10 @@ const GeneralInitForm = forwardRef<
excludeTestIds = [],
inputs,
isContinueOnFailure,
isExcludeConfirmAdminPassword = !isConfirmAdminPassword,
}: Pick<
TestInputFunctionOptions,
'inputs' | 'excludeTestIds' | 'isContinueOnFailure'
> & {
isExcludeConfirmAdminPassword?: boolean;
} = {}) => {
if (isExcludeConfirmAdminPassword) {
excludeTestIds.push(IT_IDS.confirmAdminPassword);
}
> = {}) => {
toggleSubmitDisabled?.call(
null,
testInput({
@ -400,7 +391,7 @@ const GeneralInitForm = forwardRef<
}),
);
},
[isConfirmAdminPassword, testInput, toggleSubmitDisabled],
[testInput, toggleSubmitDisabled],
);
const populateOrganizationPrefixInput = useCallback(
({
@ -808,19 +799,6 @@ const GeneralInitForm = forwardRef<
inputs: { [IT_IDS.adminPassword]: { value } },
});
},
onPasswordVisibilityAppend: (inputType) => {
const localIsConfirmAdminPassword =
inputType === INPUT_TYPES.password;
testInputToToggleSubmitDisabled({
isExcludeConfirmAdminPassword:
!localIsConfirmAdminPassword,
});
setIsConfirmAdminPassword(
localIsConfirmAdminPassword,
);
setConfirmAdminPasswordInputMessage();
},
}}
inputLabelProps={{ isNotifyRequired: true }}
label="Admin password"
@ -842,7 +820,6 @@ const GeneralInitForm = forwardRef<
ref={adminPasswordInputRef}
/>
</MUIGrid>
{isConfirmAdminPassword && (
<MUIGrid item xs={1}>
<InputWithRef
input={
@ -861,7 +838,7 @@ const GeneralInitForm = forwardRef<
},
}}
inputLabelProps={{
isNotifyRequired: isConfirmAdminPassword,
isNotifyRequired: true,
}}
label="Confirm password"
onChange={({ target: { value } }) => {
@ -877,7 +854,6 @@ const GeneralInitForm = forwardRef<
ref={confirmAdminPasswordInputRef}
/>
</MUIGrid>
)}
</MUIGrid>
</MUIGrid>
</MUIGrid>

Loading…
Cancel
Save