'use client' import Button from '@/components/button/PrimaryButton' import { EyeToggleIcon } from '@/components/icons/EyeToggleIcon' import InputField from '@/components/input/InputField' import { AUTH_PAGE_ELEMENT } from '@/enums' import Image from 'next/image' import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { glassSurfaceFlat } from '@/lib/styles/glassSurface' type Props = { onChange: ((e: React.ChangeEvent) => void) & React.ChangeEventHandler onClick: React.MouseEventHandler | undefined value: string repeatValue: string isReset?: boolean passwordVisible: boolean repeatPasswordVisible: boolean pending?: boolean | undefined } & Omit, 'id'> function StepNewPassword ({ isReset: reset = false, pending, disabled = false, onChange, onClick, value, repeatValue, passwordVisible, repeatPasswordVisible }: Props) { const [error, setError] = useState('') const [error2, setError2] = useState('') const { t } = useTranslation('auth') const hasError = (e = error) => { return e.trim().length > 0 } useEffect(() => { let error = '' let error2 = '' if (value.length > 0) { if (!/^.{6,}$/.test(value)) { error = t('Errors.PasswordLength') } } if (repeatValue.length > 0) { if (!/^.{6,}$/.test(repeatValue)) { error2 = t('Errors.PasswordLength') } else if (repeatValue !== value) { error2 = t('Errors.PasswordMatch') } } setError(error) setError2(error2) }, [value, repeatValue, t]) return ( <> login banner
{reset ? t('NewPassword.HeadingResetPass') : t('NewPassword.HeadingCreatePass')}

{t('NewPassword.Description')}

) } export default StepNewPassword