This commit is contained in:
okbel
2018-03-29 10:56:18 -03:00
parent f8fbedd727
commit 0b3b252fc3
12 changed files with 14 additions and 176 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ plugins/*
!plugins/talk-plugin-viewing-options
!plugins/talk-plugin-rich-text
!plugins/talk-plugin-rich-text-pell
!plugins/talk-plugin-health-report
!plugins/talk-plugin-auth-checkbox
**/node_modules/*
yarn-error.log
Submodule plugins/talk-plugin-auth-checkbox added at 73cf96e856
@@ -14,11 +14,3 @@ export const setPassword = password => ({
type: actions.SET_PASSWORD,
password,
});
export const enableSubmitSignUpForm = () => ({
type: actions.ENABLE_SUBMIT_SIGNUP_FORM,
});
export const disableSubmitSignUpForm = () => ({
type: actions.DISABLE_SUBMIT_SIGNUP_FORM,
});
@@ -3,5 +3,3 @@ const prefix = 'TALK_AUTH';
export const SET_VIEW = `${prefix}_SET_VIEW`;
export const SET_EMAIL = `${prefix}_SET_EMAIL`;
export const SET_PASSWORD = `${prefix}_SET_PASSWORD`;
export const ENABLE_SUBMIT_SIGNUP_FORM = `${prefix}_ENABLE_SUBMIT_SIGNUP_FORM`;
export const DISABLE_SUBMIT_SIGNUP_FORM = `${prefix}_DISABLE_SUBMIT_SIGNUP_FOR`;
@@ -22,8 +22,19 @@ class SignUpContainer extends Component {
emailError: null,
passwordError: null,
passwordRepeatError: null,
hasBlockers: [],
};
indicateBlockerOn = plugin =>
this.setState(state => ({
hasBlockers: state.hasBlockers.concat(plugin),
}));
indicateBlockerOff = plugin =>
this.setState(state => ({
hasNotifications: state.hasNotifications.filter(i => i !== plugin),
}));
validate = data => {
let valid = true;
const changes = {};
@@ -54,7 +65,7 @@ class SignUpContainer extends Component {
passwordRepeat: this.state.passwordRepeat,
};
if (this.validate(data)) {
if (this.validate(data) && !this.state.hasBlockers.length) {
this.props.signUp(data);
}
};
@@ -5,21 +5,10 @@ const initialState = {
view: views.SIGN_IN,
email: '',
password: '',
submitSignUpForm: true,
};
export default function reducer(state = initialState, action) {
switch (action.type) {
case actions.ENABLE_SUBMIT_SIGNUP_FORM:
return {
...state,
submitSignUpForm: true,
};
case actions.DISABLE_SUBMIT_SIGNUP_FORM:
return {
...state,
submitSignUpForm: false,
};
case actions.SET_VIEW:
return {
...state,
@@ -1,23 +0,0 @@
{
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
}
},
"parser": "babel-eslint",
"plugins": [
"react"
],
"rules": {
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"no-console": ["warn", { "allow": ["warn", "error"] }]
}
}
@@ -1,13 +0,0 @@
.link {
color: #2c69b6;
cursor: pointer;
margin: 0 3px;
&:last-child {
margin-right: 0;
}
}
.fieldContainer {
padding: 5px 0;
}
@@ -1,71 +0,0 @@
import React from 'react';
import { Checkbox } from 'plugin-api/beta/client/components/ui';
import { t } from 'plugin-api/beta/client/services';
import styles from './TermsAndConditionsField.css';
import cn from 'classnames';
const TermsLink = () => (
<a
className={styles.link}
href={t('talk-plugin-health-report.terms-link')}
target="_blank"
>
{t('talk-plugin-health-report.terms')}
</a>
);
const PrivacyLink = () => (
<a
className={styles.link}
href={t('talk-plugin-health-report.privacy-policy-link')}
target="_blank"
>
{t('talk-plugin-health-report.privacy-policy')}
</a>
);
class TermsAndConditionsField extends React.Component {
state = { checked: false };
id = 'terms-and-conditions';
componentWillMount() {
this.props.disableSubmitSignUpForm();
}
onChange = ({ target: { checked } }) => {
if (checked) {
this.setState(() => ({ checked }));
this.props.enableSubmitSignUpForm();
} else {
this.setState(() => ({ checked }));
this.props.disableSubmitSignUpForm();
}
};
render() {
return (
<div
className={cn(
styles.fieldContainer,
'talk-plugin-health-report-field-container'
)}
>
<Checkbox
checked={this.state.checked}
className="talk-plugin-health-report-checkbox"
onChange={this.onChange}
id={this.id}
/>
<label id={this.id} className="talk-plugin-health-report-label">
{t('talk-plugin-health-report.copy')}
<TermsLink />
{t('talk-plugin-health-report.and')}
<PrivacyLink />
{t('talk-plugin-health-report.from')}
</label>
</div>
);
}
}
export default TermsAndConditionsField;
@@ -1,9 +0,0 @@
import TermsAndConditionsField from './components/TermsAndConditionsField';
import translations from './translations.yml';
export default {
slots: {
'talkPluginAuth-formField': [TermsAndConditionsField],
},
translations,
};
@@ -1,36 +0,0 @@
en:
talk-plugin-health-report:
copy: I agree to the Mozilla
and: and
terms: Terms of Service
privacy-policy: Privacy Policy
from: .
terms-link: https://www.mozilla.org/en-US/about/legal/terms/mozilla/
privacy-policy-link: https://www.mozilla.org/en-US/privacy/websites/
es:
talk-plugin-health-report:
copy: Estoy de acuerdo con
and: y
terms: los Terminos y Condiciones
privacy-policy: la Política de Privacidad
from: de Mozilla.
terms-link: https://www.mozilla.org/es-ES/about/legal/terms/mozilla/
privacy-policy-link: https://www.mozilla.org/es-ES/privacy/websites/
fr:
talk-plugin-health-report:
copy: J'accepte
and: et
terms: les conditions d'utilisation
privacy-policy: la politique de confidentialité
from: de Mozilla.
terms-link: https://www.mozilla.org/fr/about/legal/terms/mozilla/
privacy-policy-link: https://www.mozilla.org/fr/privacy/websites/
de:
talk-plugin-health-report:
copy: Ich stimme
and: und
terms: den Allgemeinen Geschäftsbedingungen
privacy-policy: der Datenschutzrichtlinie
from: von Mozilla zu.
terms-link: https://www.mozilla.org/de/about/legal/terms/mozilla/
privacy-policy-link: https://www.mozilla.org/de/privacy/websites/
@@ -1 +0,0 @@
module.exports = {};