Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.required(FieldDict['userId'].label + ' is required.'),
userType: Yup.string()
.max(16, FieldDict['userType'].label + ' cannot be longer than ${max}')
.required(FieldDict['userType'].label + ' is required.'),
firstName: Yup.string()
.max(32, FieldDict['firstName'].label + ' cannot be longer than ${max}')
.required(FieldDict['firstName'].label + ' is required.'),
lastName: Yup.string()
.max(32, FieldDict['lastName'].label + ' cannot be longer than ${max}')
.required(FieldDict['lastName'].label + ' is required.'),
email: Yup.string()
.email('Invalid email address')
.max(64, FieldDict['email'].label + ' cannot be longer than ${max}'),
password: Yup.string()
.max(1024, FieldDict['password'].label + ' cannot be longer than ${max}'),
passwordConfirm: Yup.match('password', 'Passwords do not match'),
roles: Yup.string()
.max(2048, FieldDict['roles'].label + ' cannot be longer than ${max}'),
});
export class UserEditor extends React.Component {
constructor(props){
super(props);
this.save=props.save;
this.close=props.close;
}
render(){
let initialValues = {
userId: '',
userType: '',
newPassword: {
placeholder: 'New Password',
label: 'New Password'
},
newPasswordConfirm: {
placeholder: 'New Password Confirm',
label: 'New Password Confirm'
}
};
const PSWDSchema = {
password: Yup.string()
.max(1024, PSWDFieldDict['password'].label + ' cannot be longer than ${max}'),
newPassword: Yup.string()
.max(1024, PSWDFieldDict['newPassword'].label + ' cannot be longer than ${max}'),
newPasswordConfirm: Yup.match('password', 'Passwords do not match'),
}
const PasswordEditor = ({save, close}) => (
{
save(values);
resetForm();