wizard: add confirm password to users step (HMS-4903)

this commit add confirm password to users step
This commit is contained in:
Michal Gold 2024-12-31 12:24:01 +02:00 committed by Klara Simickova
parent b9d6cc886a
commit ba70753a80
2 changed files with 43 additions and 0 deletions

View file

@ -6,9 +6,11 @@ import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import { GENERATING_SSH_KEY_PAIRS_URL } from '../../../../../constants';
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
import {
selectUserConfirmPassword,
selectUserNameByIndex,
selectUserPasswordByIndex,
selectUserSshKeyByIndex,
setUserConfirmPasswordByIndex,
setUserNameByIndex,
setUserPasswordByIndex,
setUserSshKeyByIndex,
@ -21,6 +23,8 @@ const UserInfo = () => {
const userName = useAppSelector(userNameSelector);
const userPasswordSelector = selectUserPasswordByIndex(index);
const userPassword = useAppSelector(userPasswordSelector);
const userConfirmPasswordSelector = selectUserConfirmPassword(index);
const userConfirmPassword = useAppSelector(userConfirmPasswordSelector);
const userSshKeySelector = selectUserSshKeyByIndex(index);
const userSshKey = useAppSelector(userSshKeySelector);
@ -38,6 +42,15 @@ const UserInfo = () => {
dispatch(setUserPasswordByIndex({ index: index, password: value }));
};
const handleConfirmPasswordChange = (
_event: React.FormEvent<HTMLInputElement>,
value: string
) => {
dispatch(
setUserConfirmPasswordByIndex({ index: index, confirmPassword: value })
);
};
const handleSshKeyChange = (
_event: React.FormEvent<HTMLInputElement>,
value: string
@ -72,6 +85,16 @@ const UserInfo = () => {
fieldName="userPassword"
/>
</FormGroup>
<FormGroup isRequired label="Confirm Password">
<HookValidatedInput
ariaLabel="blueprint user confirm password"
value={userConfirmPassword || ''}
onChange={(_e, value) => handleConfirmPasswordChange(_e, value)}
placeholder="Confirm Password"
stepValidation={stepValidation}
fieldName="userConfirmPassword"
/>
</FormGroup>
<FormGroup isRequired label="SSH key">
<HookValidatedInput
ariaLabel="public SSH key"