From 02bd8abcd1c43a3fb8ad1984e2fcf6578cf1a46a Mon Sep 17 00:00:00 2001 From: Zainab Amir Date: Tue, 13 Feb 2024 00:54:26 -0800 Subject: [PATCH] feat: update default authn settings (#1160) At present, Authn MFE doesn't work out of the box with devstack settings. These changes allow authn to work with default devstack settings. --- .env.development | 3 +++ src/register/data/utils.js | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) 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']);