diff --git a/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsx b/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsx index 2feadc15831..173081f8a6b 100644 --- a/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsx +++ b/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsx @@ -194,9 +194,25 @@ export const getPhoneProviderValidationSchema = (config: ProjectAuthConfigData) }), // Phone SMS - SMS_OTP_EXP: number().min(0, 'Must be more than 0').required('This is required'), - SMS_OTP_LENGTH: number().min(6, 'Must be 6 or more in length').required('This is required'), - SMS_TEMPLATE: string().required('SMS template is required.'), + SMS_OTP_EXP: number() + .min(0, 'Must be more than 0') + .when('SMS_PROVIDER', { + is: (val: string) => val !== 'twilio_verify', + then: (schema) => schema.required('This is required'), + otherwise: (schema) => schema, + }), + SMS_OTP_LENGTH: number() + .min(6, 'Must be 6 or more in length') + .when('SMS_PROVIDER', { + is: (val: string) => val !== 'twilio_verify', + then: (schema) => schema.required('This is required'), + otherwise: (schema) => schema, + }), + SMS_TEMPLATE: string().when('SMS_PROVIDER', { + is: (val: string) => val !== 'twilio_verify', + then: (schema) => schema.required('SMS template is required.'), + otherwise: (schema) => schema, + }), SMS_TEST_OTP: string() .matches( /^\s*([0-9]{1,15}=[0-9]+)(\s*,\s*[0-9]{1,15}=[0-9]+)*\s*$/g,