+
+
+
+
+
-
+
{t('hub_create_account_checkbox_promotions')}
@@ -212,12 +231,14 @@ CreateAccountView.propTypes = {
confirmEmailError: PropTypes.bool.isRequired,
firstName: PropTypes.string.isRequired,
lastName: PropTypes.string.isRequired,
+ legalConsentChecked: PropTypes.bool.isRequired,
password: PropTypes.string.isRequired,
passwordInvalidError: PropTypes.bool.isRequired,
passwordLengthError: PropTypes.bool.isRequired,
promotionsChecked: PropTypes.bool.isRequired,
handleInputChange: PropTypes.func.isRequired,
- handleCheckboxChange: PropTypes.func.isRequired,
+ handleLegalConsentCheckboxChange: PropTypes.func.isRequired,
+ handlePromotionsCheckboxChange: PropTypes.func.isRequired,
handleSubmit: PropTypes.func.isRequired,
};
diff --git a/app/hub/Views/CreateAccountView/CreateAccountView.scss b/app/hub/Views/CreateAccountView/CreateAccountView.scss
index bc3b7012c..489e3ecbe 100644
--- a/app/hub/Views/CreateAccountView/CreateAccountView.scss
+++ b/app/hub/Views/CreateAccountView/CreateAccountView.scss
@@ -11,6 +11,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0
*/
+$color-create-account-form-error-red: #e74055;
+
// Create Account View
.CreateAccountView {
padding-top: 80px;
@@ -54,17 +56,17 @@
}
.CreateAccountView__inputBox.error {
margin-bottom: 8px;
- border-color: #e74055;
+ border-color: $color-create-account-form-error-red;
}
.CreateAccountView__inputBox:focus {
// Foundation Overrides
box-shadow: none;
- border-color: #4a4a4a;
+ border-color: $color-create-account-form-error-red;
}
.CreateAccountView__inputError {
font-size: 12;
line-height: 14px;
- color: #e74055;
+ color: $color-create-account-form-error-red;
margin-bottom: 13px;
}
.CreateAccountView__link {
@@ -77,6 +79,13 @@
.CreateAccountView__button {
min-width: 180px;
}
+.CreateAccountView__inputLabel {
+ flex-grow: 1; // ensure left-justify alignment in single column layout
+ padding-top: 10px; // align with checkbox top
+}
+.CreateAccountView__inputLabel.error{
+ color: $color-create-account-form-error-red;
+}
@media only screen and (max-width: 740px) {
.CreateAccountView {
padding-top: 20px;
diff --git a/app/hub/Views/CreateAccountView/CreateAccountViewContainer.jsx b/app/hub/Views/CreateAccountView/CreateAccountViewContainer.jsx
index 0167899c6..f44f9cf34 100644
--- a/app/hub/Views/CreateAccountView/CreateAccountViewContainer.jsx
+++ b/app/hub/Views/CreateAccountView/CreateAccountViewContainer.jsx
@@ -37,6 +37,8 @@ class CreateAccountViewContainer extends Component {
confirmEmailError: false,
firstName: '',
lastName: '',
+ legalConsentChecked: false,
+ legalConsentNotCheckedError: false,
password: '',
passwordInvalidError: false,
passwordLengthError: false,
@@ -93,11 +95,17 @@ class CreateAccountViewContainer extends Component {
}
/**
- * Update input checkbox values by updating state.
+ * Update legal consetnt checkbox value by updating state
*/
- _handleCheckboxChange = () => {
- const promotionsChecked = !this.state.promotionsChecked;
- this.setState({ promotionsChecked });
+ _handleLegalConsentCheckboxChange = () => {
+ this.setState(prevState => ({ legalConsentChecked: !prevState.legalConsentChecked }));
+ }
+
+ /**
+ * Update promotions checkbox value by updating state
+ */
+ _handlePromotionsCheckboxChange = () => {
+ this.setState(prevState => ({ promotionsChecked: !prevState.promotionsChecked }));
}
/**
@@ -111,6 +119,7 @@ class CreateAccountViewContainer extends Component {
confirmEmail,
firstName,
lastName,
+ legalConsentChecked,
password,
promotionsChecked
} = this.state;
@@ -123,12 +132,13 @@ class CreateAccountViewContainer extends Component {
this.setState({
emailError: !emailIsValid,
confirmEmailError: !confirmIsValid,
+ legalConsentNotCheckedError: !legalConsentChecked,
passwordInvalidError: invalidChars,
passwordLengthError: invalidLength,
validateInput: true,
});
- if (!emailIsValid || !confirmIsValid || !passwordIsValid) {
+ if (!emailIsValid || !confirmIsValid || !legalConsentChecked || !passwordIsValid) {
return;
}
this.props.actions.setToast({
@@ -166,6 +176,8 @@ class CreateAccountViewContainer extends Component {
confirmEmailError,
firstName,
lastName,
+ legalConsentChecked,
+ legalConsentNotCheckedError,
password,
passwordInvalidError,
passwordLengthError,
@@ -178,12 +190,15 @@ class CreateAccountViewContainer extends Component {
confirmEmailError,
firstName,
lastName,
+ legalConsentChecked,
+ legalConsentNotCheckedError,
password,
passwordInvalidError,
passwordLengthError,
promotionsChecked,
handleInputChange: this._handleInputChange,
- handleCheckboxChange: this._handleCheckboxChange,
+ handleLegalConsentCheckboxChange: this._handleLegalConsentCheckboxChange,
+ handlePromotionsCheckboxChange: this._handlePromotionsCheckboxChange,
handleSubmit: this._handleCreateAccountAttempt
};
const signedInChildProps = {
diff --git a/app/hub/Views/CreateAccountView/__tests__/__snapshots__/CreateAccountView.test.jsx.snap b/app/hub/Views/CreateAccountView/__tests__/__snapshots__/CreateAccountView.test.jsx.snap
index 7c9fd68cb..521f262e7 100644
--- a/app/hub/Views/CreateAccountView/__tests__/__snapshots__/CreateAccountView.test.jsx.snap
+++ b/app/hub/Views/CreateAccountView/__tests__/__snapshots__/CreateAccountView.test.jsx.snap
@@ -145,11 +145,33 @@ exports[`app/hub/Views/CreateAccount component Snapshot tests with react-test-re
className="columns small-12 medium-5"
>
+
+
+
+
+
+
+ {/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
+
+
+
+
@@ -210,9 +229,6 @@ class CreateAccount extends React.Component {