From 6bc11b01f55f451ccafb19d248367dfb74d9461c Mon Sep 17 00:00:00 2001 From: Shafqat Farhan Date: Tue, 5 Oct 2021 11:58:14 +0500 Subject: [PATCH] fix: VAN-719 - Handled password field error violation on username change (#444) --- src/register/RegistrationPage.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index b129c222..0f822daf 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -79,6 +79,7 @@ class RegistrationPage extends React.Component { totalRegistrationTime: 0, optimizelyExperimentName: '', // eslint-disable-line react/no-unused-state readOnly: true, + validatePassword: false, }; } @@ -103,7 +104,11 @@ class RegistrationPage extends React.Component { shouldComponentUpdate(nextProps) { if (this.props.validationDecisions !== nextProps.validationDecisions) { const state = { errors: { ...this.state.errors, ...nextProps.validationDecisions } }; + let validatePassword = false; + if (state.errors.password) { + validatePassword = true; + } if (nextProps.registrationErrorCode) { state.errorCode = nextProps.registrationErrorCode; } @@ -126,6 +131,7 @@ class RegistrationPage extends React.Component { suggestedTopLevelDomain, suggestedSldMessage, suggestedServiceLevelDomain, + validatePassword, }); return false; } @@ -381,6 +387,9 @@ class RegistrationPage extends React.Component { } else { errors.username = ''; } + if (this.state.validatePassword) { + this.props.fetchRealtimeValidations({ ...payload, form_field_key: 'password' }); + } break; case 'password': errors.password = '';