Fix saving up settings

This commit is contained in:
Pierre Noël 2021-12-03 11:49:22 +01:00
parent bb53ba8638
commit d676242c8f

View File

@ -4,15 +4,14 @@ import { translatedErrors } from '@strapi/helper-plugin';
const URL_REGEX = new RegExp('(^$)|((https?://.*)(d*)/?(.*))'); const URL_REGEX = new RegExp('(^$)|((https?://.*)(d*)/?(.*))');
const schema = yup.object().shape({ const schema = yup.object().shape({
email_confirmation_redirection: yup email_confirmation_redirection: yup.mixed().when('email_confirmation', {
.string(translatedErrors.string) is: true,
.matches(URL_REGEX, translatedErrors.regex) then: yup
.nullable() .string()
.when('email_confirmation', { .matches(URL_REGEX)
is: true, .required(),
then: yup.string().required(translatedErrors.required), otherwise: yup.string().nullable(),
otherwise: yup.string(), }),
}),
email_reset_password: yup email_reset_password: yup
.string(translatedErrors.string) .string(translatedErrors.string)
.matches(URL_REGEX, translatedErrors.regex) .matches(URL_REGEX, translatedErrors.regex)