diff --git a/.env b/.env index 9187d665..01f93d5f 100644 --- a/.env +++ b/.env @@ -25,4 +25,4 @@ DISABLE_ENTERPRISE_LOGIN='' REGISTER_CONVERSION_COOKIE_NAME=null ENABLE_PROGRESSIVE_PROFILING='' MARKETING_EMAILS_OPT_IN='false' -COLLECT_YEAR_OF_BIRTH='true' +ENABLE_COPPA_COMPLIANCE='' diff --git a/.env.development b/.env.development index 98e396ab..3d928496 100644 --- a/.env.development +++ b/.env.development @@ -30,4 +30,4 @@ WELCOME_PAGE_SUPPORT_LINK='http://localhost:1999/welcome' INFO_EMAIL='info@edx.org' DISABLE_ENTERPRISE_LOGIN='' REGISTER_CONVERSION_COOKIE_NAME='openedx-user-register-conversion' -COLLECT_YEAR_OF_BIRTH='true' +ENABLE_COPPA_COMPLIANCE='' diff --git a/.env.test b/.env.test index 0d262bfe..31f73eb6 100644 --- a/.env.test +++ b/.env.test @@ -23,4 +23,4 @@ WELCOME_PAGE_SUPPORT_LINK='http://localhost:1999/welcome' DISABLE_ENTERPRISE_LOGIN='' REGISTER_CONVERSION_COOKIE_NAME='openedx-user-register-conversion' MARKETING_EMAILS_OPT_IN='false' -COLLECT_YEAR_OF_BIRTH='true' +ENABLE_COPPA_COMPLIANCE='' diff --git a/src/index.jsx b/src/index.jsx index 8468933a..dad770cc 100755 --- a/src/index.jsx +++ b/src/index.jsx @@ -40,7 +40,7 @@ initialize({ REGISTER_CONVERSION_COOKIE_NAME: process.env.REGISTER_CONVERSION_COOKIE_NAME || null, ENABLE_PROGRESSIVE_PROFILING: process.env.ENABLE_PROGRESSIVE_PROFILING || false, MARKETING_EMAILS_OPT_IN: process.env.MARKETING_EMAILS_OPT_IN || 'false', - COLLECT_YEAR_OF_BIRTH: process.env.COLLECT_YEAR_OF_BIRTH || 'true', + ENABLE_COPPA_COMPLIANCE: process.env.ENABLE_COPPA_COMPLIANCE || '', }); }, }, diff --git a/src/register/OptionalFields.jsx b/src/register/OptionalFields.jsx index eebbdf6c..c5317061 100644 --- a/src/register/OptionalFields.jsx +++ b/src/register/OptionalFields.jsx @@ -2,6 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { getConfig } from '@edx/frontend-platform'; import { Form, Icon } from '@edx/paragon'; import { ExpandMore } from '@edx/paragon/icons'; @@ -13,7 +14,12 @@ const OptionalFields = (props) => { intl, optionalFields, onChangeHandler, values, } = props; + if (getConfig().ENABLE_COPPA_COMPLIANCE && EDUCATION_LEVELS) { + const index = EDUCATION_LEVELS.indexOf('el'); + EDUCATION_LEVELS.splice(index, 1); + } const getOptions = () => ({ + yearOfBirthOptions: YEAR_OF_BIRTH_OPTIONS.map(({ value, label }) => ( )), diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index a5cf0bc3..259d6d04 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -400,6 +400,7 @@ class RegistrationPage extends React.Component { } else { errors.name = ''; } + if (!this.state.username.trim() && this.state.optimizelyExperimentName === 'suggestUsernameUsingFullname') { this.props.fetchRealtimeValidations(payload); // Fire optimizely events diff --git a/src/welcome/WelcomePage.jsx b/src/welcome/WelcomePage.jsx index f8218c46..200c07fb 100644 --- a/src/welcome/WelcomePage.jsx +++ b/src/welcome/WelcomePage.jsx @@ -68,6 +68,11 @@ const WelcomePage = (props) => { return null; } + if (getConfig().ENABLE_COPPA_COMPLIANCE && EDUCATION_LEVELS) { + const index = EDUCATION_LEVELS.indexOf('el'); + EDUCATION_LEVELS.splice(index, 1); + } + const getOptions = (fieldName) => { const options = { yearOfBirth: YEAR_OF_BIRTH_OPTIONS.map(({ value, label }) => ( @@ -170,7 +175,7 @@ const WelcomePage = (props) => { {getOptions('levelOfEducation')} - {(getConfig().COLLECT_YEAR_OF_BIRTH === 'true') + {(!getConfig().ENABLE_COPPA_COMPLIANCE) && ( { level_of_education: 'other', gender: 'm', }; - mergeConfig({ - COLLECT_YEAR_OF_BIRTH: 'true', - }); store.dispatch = jest.fn(store.dispatch); const welcomePage = await getWelcomePage();