Commit aeeea9c5 by Arjun Jhukal

minor changes

parent 0a2e890b
......@@ -12,6 +12,7 @@ interface PasswordFieldProps {
onChange: React.ChangeEventHandler<HTMLInputElement>;
onBlur: React.FocusEventHandler<HTMLInputElement>;
error?: string;
required?: boolean;
}
export default function PasswordField({
......@@ -22,6 +23,7 @@ export default function PasswordField({
onChange,
onBlur,
error,
required = false
}: PasswordFieldProps) {
const [showPassword, setShowPassword] = useState(false);
......@@ -29,7 +31,7 @@ export default function PasswordField({
const handleMouseDownPassword = (event: React.MouseEvent<HTMLButtonElement>) => event.preventDefault();
return (
<div className="input_field">
<InputLabel htmlFor={name}>{label} <span className="text-red-500">*</span></InputLabel>
<InputLabel htmlFor={name}>{label} {required && <span className="text-red-500">*</span>}</InputLabel>
<OutlinedInput
id={name}
name={name}
......
......@@ -74,7 +74,7 @@ const validationSchema = Yup.object().shape({
'Password cannot start or end with spaces',
(value) => value === value?.trim()
)
.max(16, 'Password must be less than 10 characters'),
.min(9, 'Password must be at least 9 characters'),
confirmPassword: Yup.string()
.oneOf([Yup.ref('password')], 'Passwords must match')
.required('Confirm Password is required'),
......
......@@ -184,7 +184,7 @@ export default function AddPlayerForm({ formik, id, data, loading, buttonLabel }
</div>
<div className="input__field">
<InputLabel htmlFor="pob">State</InputLabel>
<InputLabel htmlFor="pob">State <span className="text-red-500">*</span></InputLabel>
<Select
fullWidth
......@@ -291,6 +291,7 @@ export default function AddPlayerForm({ formik, id, data, loading, buttonLabel }
<div className="input__field">
<PasswordField
required={id ? false : true}
name="password"
label="Password*"
placeholder="Enter password"
......@@ -303,6 +304,8 @@ export default function AddPlayerForm({ formik, id, data, loading, buttonLabel }
<div className="input__field">
<PasswordField
required={id ? false : true}
name="password_confirmation"
label="Confirm Password*"
placeholder="Confirm password"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment