Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
inputs: [
[
{
label: {
id: 'Auth.form.forgot-password.email.label',
},
name: 'email',
type: 'email',
placeholder: 'Auth.form.forgot-password.email.placeholder',
},
],
],
schema: yup.object({
email: yup
.string()
.email(translatedErrors.email)
.required(translatedErrors.required),
}),
},
login: {
endPoint: 'local',
inputs: [
[
{
label: {
id: 'Auth.form.login.username.label',
},
name: 'identifier',
type: 'text',
placeholder: 'Auth.form.login.username.placeholder',
},
],
if (value === undefined) {
return true;
}
try {
JSON.parse(value);
return true;
} catch (err) {
return false;
}
})
.nullable();
}
if (type === 'email') {
schema = schema.email(errorsTrads.email);
}
if (['number', 'integer', 'biginteger', 'float', 'decimal'].includes(type)) {
schema = yup
.number()
.transform(cv => (isNaN(cv) ? undefined : cv))
.typeError();
}
if (['date', 'datetime'].includes(type)) {
schema = yup.date();
}
Object.keys(validations).forEach(validation => {
const validationValue = validations[validation];
if (
!!validationValue ||
((!isBoolean(validationValue) &&
) {
return true;
}
try {
JSON.parse(value);
return true;
} catch (err) {
return false;
}
})
.nullable();
}
if (type === 'email') {
schema = schema.email(errorsTrads.email);
}
if (['number', 'integer', 'biginteger', 'float', 'decimal'].includes(type)) {
schema = yup
.number()
.transform(cv => (isNaN(cv) ? undefined : cv))
.typeError();
}
if (['date', 'datetime'].includes(type)) {
schema = yup.date();
}
if (type === 'biginteger') {
schema = yup.string().matches(/^\d*$/);
}
],
[
{
label: {
id: 'Auth.form.register.news.label',
},
name: 'news',
type: 'checkbox',
value: false,
},
],
],
schema: yup.object({
email: yup
.string()
.email(translatedErrors.email)
.required(translatedErrors.required),
username: yup.string().required(translatedErrors.required),
password: yup
.string()
.min(6, translatedErrors.minLength)
.required(translatedErrors.required),
passwordConfirmation: yup
.string()
.min(6, translatedErrors.minLength)
.oneOf(
[yup.ref('password'), null],
'components.Input.error.password.noMatch'
)
.required(translatedErrors.required),
}),
},