|
@@ -85,7 +85,7 @@ const ChagnePasswordForm: React.FC<PasswordRulesProps> = ({ pwRules:rules }) => |
|
|
} else if (index === 3 && rules.number && !/[0-9]/.test(inputValue)) { |
|
|
} else if (index === 3 && rules.number && !/[0-9]/.test(inputValue)) { |
|
|
//testing for numbers |
|
|
//testing for numbers |
|
|
return "red"; |
|
|
return "red"; |
|
|
} else if (index === 4 && rules.specialChar && !/[!@#$%^&-=+_*(),.?":{}|<>]/.test(inputValue)) { |
|
|
|
|
|
|
|
|
} else if (index === 4 && rules.specialChar && !/[-!@#$%^&=+_*(),.?":{}|<>]/.test(inputValue)) { |
|
|
//testing for special characters |
|
|
//testing for special characters |
|
|
return "red"; |
|
|
return "red"; |
|
|
} else { |
|
|
} else { |
|
@@ -94,6 +94,10 @@ const ChagnePasswordForm: React.FC<PasswordRulesProps> = ({ pwRules:rules }) => |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (!/[-!@#$%^&=+_*(),.?":{}|<>]/.test('12')) { |
|
|
|
|
|
console.log(!/[-!@#$%^&=+_*(),.?":{}|<>]/.test('12')) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => { |
|
|
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => { |
|
|
// Update the theme with the new color based on the input value |
|
|
// Update the theme with the new color based on the input value |
|
|
const newInputValue = event.target.value; |
|
|
const newInputValue = event.target.value; |
|
@@ -187,7 +191,9 @@ const ChagnePasswordForm: React.FC<PasswordRulesProps> = ({ pwRules:rules }) => |
|
|
component: (props) => { |
|
|
component: (props) => { |
|
|
return ( |
|
|
return ( |
|
|
<FormHelperText {...props}> |
|
|
<FormHelperText {...props}> |
|
|
{(props.children as string[]).map((line, index) => ( |
|
|
|
|
|
|
|
|
{(props.children as string[]).map((line, index) => { |
|
|
|
|
|
console.log(index, getColorFromInput(inputValue, msgList)[index]) |
|
|
|
|
|
return ( |
|
|
<span |
|
|
<span |
|
|
key={index} |
|
|
key={index} |
|
|
style={{ |
|
|
style={{ |
|
@@ -204,11 +210,12 @@ const ChagnePasswordForm: React.FC<PasswordRulesProps> = ({ pwRules:rules }) => |
|
|
)} |
|
|
)} |
|
|
{line} |
|
|
{line} |
|
|
{index < |
|
|
{index < |
|
|
(props.children as string[]).length - 1 && ( |
|
|
|
|
|
|
|
|
(props.children as string[]).length && ( |
|
|
<br /> |
|
|
<br /> |
|
|
)} |
|
|
)} |
|
|
</span> |
|
|
</span> |
|
|
))} |
|
|
|
|
|
|
|
|
)} |
|
|
|
|
|
)} |
|
|
</FormHelperText> |
|
|
</FormHelperText> |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
|