diff --git a/.env.development b/.env.development index 8bc4997f..e085d5e3 100644 --- a/.env.development +++ b/.env.development @@ -19,6 +19,9 @@ REFRESH_ACCESS_TOKEN_ENDPOINT='http://localhost:18000/login_refresh' SEGMENT_KEY='' SITE_NAME='Your Platform Name Here' INFO_EMAIL='info@example.com' +# ***** Features ***** +ENABLE_DYNAMIC_REGISTRATION_FIELDS='true' +ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN='true' # ***** Cookies ***** SESSION_COOKIE_DOMAIN='localhost' USER_INFO_COOKIE_NAME='edx-user-info' diff --git a/src/register/data/utils.js b/src/register/data/utils.js index 591640eb..450204aa 100644 --- a/src/register/data/utils.js +++ b/src/register/data/utils.js @@ -1,4 +1,4 @@ -import { getConfig, snakeCaseObject } from '@edx/frontend-platform'; +import { snakeCaseObject } from '@edx/frontend-platform'; import { LETTER_REGEX, NUMBER_REGEX } from '../../data/constants'; import messages from '../messages'; @@ -44,15 +44,15 @@ export const isFormValid = ( } }); - if (getConfig().SHOW_CONFIGURABLE_EDX_FIELDS) { - if (!configurableFormFields?.country?.displayValue) { - fieldErrors.country = formatMessage(messages['empty.country.field.error']); - isValid = false; - } else if (!configurableFormFields?.country?.countryCode) { - fieldErrors.country = formatMessage(messages['invalid.country.field.error']); - isValid = false; - } + // Don't validate when country field is optional or hidden and not present on registration form + if (configurableFormFields?.country && !configurableFormFields.country?.displayValue) { + fieldErrors.country = formatMessage(messages['empty.country.field.error']); + isValid = false; + } else if (configurableFormFields?.country && !configurableFormFields.country?.countryCode) { + fieldErrors.country = formatMessage(messages['invalid.country.field.error']); + isValid = false; } + Object.keys(fieldDescriptions).forEach(key => { if (key === 'country' && !configurableFormFields.country.displayValue) { fieldErrors[key] = formatMessage(messages['empty.country.field.error']);