diff --git a/src/forgot-password/ForgotPasswordPage.jsx b/src/forgot-password/ForgotPasswordPage.jsx index 5add4bd6..86a25205 100644 --- a/src/forgot-password/ForgotPasswordPage.jsx +++ b/src/forgot-password/ForgotPasswordPage.jsx @@ -100,7 +100,7 @@ const ForgotPasswordPage = (props) => { validateOnChange={false} validate={(values) => { const validationMessage = getValidationMessage(values.email); - + props.setForgotPasswordFormData({ emailValidationError: validationMessage }); if (validationMessage !== '') { windowScrollTo({ left: 0, top: 0, behavior: 'smooth' }); return { email: validationMessage }; diff --git a/src/index.jsx b/src/index.jsx index 4dc9a66a..c41a80c5 100755 --- a/src/index.jsx +++ b/src/index.jsx @@ -40,7 +40,7 @@ initialize({ INFO_EMAIL: process.env.INFO_EMAIL || '', 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 || true, + MARKETING_EMAILS_OPT_IN: process.env.MARKETING_EMAILS_OPT_IN || '', ENABLE_COPPA_COMPLIANCE: process.env.ENABLE_COPPA_COMPLIANCE || '', SHOW_DYNAMIC_PROFILING_PAGE: process.env.SHOW_DYNAMIC_PROFILING_PAGE || false, ENABLE_DYNAMIC_REGISTRATION_FIELDS: process.env.ENABLE_DYNAMIC_REGISTRATION_FIELDS || false, diff --git a/src/login/LoginPage.jsx b/src/login/LoginPage.jsx index a48fc310..8a65334d 100644 --- a/src/login/LoginPage.jsx +++ b/src/login/LoginPage.jsx @@ -70,13 +70,17 @@ class LoginPage extends React.Component { } shouldComponentUpdate(nextProps) { - if (this.props.loginFormData !== nextProps.loginFormData) { - if (nextProps.loginFormData) { - this.setState({ - ...nextProps.loginFormData, - }); - return false; - } + if (nextProps.loginFormData && this.props.loginFormData !== nextProps.loginFormData) { + // Ensuring browser's autofill user credentials get filled and their state persists in the redux store. + const nextState = { + emailOrUsername: nextProps.loginFormData.emailOrUsername || this.state.emailOrUsername, + password: nextProps.loginFormData.password || this.state.password, + }; + this.setState({ + ...nextProps.loginFormData, + ...nextState, + }); + return false; } return true; } diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index 32123855..e65c230c 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -120,15 +120,19 @@ class RegistrationPage extends React.Component { } shouldComponentUpdate(nextProps) { - if (this.props.registrationFormData !== nextProps.registrationFormData) { - if (nextProps.registrationFormData) { - // do not set focused field's value from redux store to retain entered data in focused field - const { focusedField } = this.state; - const { [focusedField]: _, ...registrationData } = nextProps.registrationFormData; - this.setState({ - ...registrationData, - }); - } + if (nextProps.registrationFormData && this.props.registrationFormData !== nextProps.registrationFormData) { + // Ensuring browser's autofill user credentials get filled and their state persists in the redux store. + const nextState = { + username: nextProps.registrationFormData.username || this.state.username, + password: nextProps.registrationFormData.password || this.state.password, + }; + + // do not set focused field's value from redux store to retain entered data in focused field\ + const { focusedField } = this.state; + const { [focusedField]: _, ...registrationData } = { ...nextProps.registrationFormData, ...nextState }; + this.setState({ + ...registrationData, + }); } if (this.props.usernameSuggestions.length > 0 && this.state.username === '') {