Merged in fix/LOY-227-password-input-validation-crash (pull request #1835)
fix(LOY-227): use new getErrorMessage for PasswordInput * fix(LOY-227): improve error message handling in PasswordInput component Approved-by: Christian Andolf Approved-by: Linus Flood
This commit is contained in:
@@ -12,6 +12,8 @@ import AriaInputWithLabel from "@/components/TempDesignSystem/Form/Input/AriaInp
|
||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||
import { passwordValidators } from "@/utils/zod/passwordValidator"
|
||||
|
||||
import { getErrorMessage } from "../Input/errors"
|
||||
|
||||
import styles from "./passwordInput.module.css"
|
||||
|
||||
import type { PasswordValidatorKey } from "@/types/components/form/newPassword"
|
||||
@@ -109,25 +111,21 @@ export default function PasswordInput({
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{isNewPassword && (
|
||||
{isNewPassword ? (
|
||||
<NewPasswordValidation value={field.value} errors={errors} />
|
||||
)}
|
||||
) : null}
|
||||
|
||||
{isNewPassword ? (
|
||||
!field.value && fieldState.error ? (
|
||||
<Caption className={styles.error} fontOnly>
|
||||
<MaterialIcon icon="info" color="Icon/Feedback/Error" />
|
||||
{fieldState.error.message}
|
||||
{getErrorMessage(intl, fieldState.error.message)}
|
||||
</Caption>
|
||||
) : null
|
||||
) : fieldState.error ? (
|
||||
<Caption className={styles.error} fontOnly>
|
||||
<MaterialIcon icon="info" color="Icon/Feedback/Error" />
|
||||
{fieldState.error &&
|
||||
intl.formatMessage({
|
||||
// eslint-disable-next-line formatjs/enforce-default-message
|
||||
defaultMessage: fieldState.error.message,
|
||||
})}
|
||||
{getErrorMessage(intl, fieldState.error.message)}
|
||||
</Caption>
|
||||
) : null}
|
||||
</TextField>
|
||||
|
||||
Reference in New Issue
Block a user