diff --git a/configs/project/client.js b/configs/project/client.js
index c6e585a..4efd779 100755
--- a/configs/project/client.js
+++ b/configs/project/client.js
@@ -8,4 +8,5 @@ module.exports = {
trackingID: 'UA-86112397-1',
},
},
+ recaptcha: require('./recaptcha/client'),
};
diff --git a/configs/project/recaptcha/client.js b/configs/project/recaptcha/client.js
new file mode 100644
index 0000000..24f1d28
--- /dev/null
+++ b/configs/project/recaptcha/client.js
@@ -0,0 +1,11 @@
+module.exports = {
+ development: {
+ siteKey: '6LfQGgoUAAAAAANHp6AvQOYD81JU9GnThpiIK7pH',
+ },
+ test: {
+ siteKey: '6LfQGgoUAAAAAANHp6AvQOYD81JU9GnThpiIK7pH',
+ },
+ production: {
+ siteKey: '6LeoHAoUAAAAAHKlo43OuPREJb22GLmik2HSaFC1',
+ },
+};
diff --git a/configs/project/recaptcha/credential.tmpl.js b/configs/project/recaptcha/credential.tmpl.js
new file mode 100644
index 0000000..11d5f79
--- /dev/null
+++ b/configs/project/recaptcha/credential.tmpl.js
@@ -0,0 +1,11 @@
+module.exports = {
+ development: {
+ secretKey: 'akb48akb48akb48akb48akb48akb48akb48akb48',
+ },
+ test: {
+ secretKey: 'akb48akb48akb48akb48akb48akb48akb48akb48',
+ },
+ production: {
+ secretKey: 'akc49akc49akc49akc49akc49akc49akc49akc49',
+ },
+};
diff --git a/configs/project/server.js b/configs/project/server.js
index 00b5313..deb8eb6 100755
--- a/configs/project/server.js
+++ b/configs/project/server.js
@@ -18,5 +18,6 @@ if (process.env.TRAVIS) {
facebook: require('./passportStrategy/facebook/credential'),
linkedin: require('./passportStrategy/linkedin/credential'),
},
+ recaptcha: require('./recaptcha/credential'),
};
}
diff --git a/package.json b/package.json
index f83ba0a..ade8f7e 100644
--- a/package.json
+++ b/package.json
@@ -115,6 +115,7 @@
"react-bootstrap": "^0.30.5",
"react-dom": "^15.0.2",
"react-ga": "^2.1.2",
+ "react-google-recaptcha": "^0.5.4",
"react-helmet": "^3.0.2",
"react-intl": "^2.1.2",
"react-native": "^0.31.0",
diff --git a/src/common/components/forms/RegisterForm.js b/src/common/components/forms/RegisterForm.js
index cb9d87f..1f2a4b4 100644
--- a/src/common/components/forms/RegisterForm.js
+++ b/src/common/components/forms/RegisterForm.js
@@ -8,6 +8,7 @@ import userAPI from '../../api/user';
import { validateForm } from '../../actions/formActions';
import { pushErrors } from '../../actions/errorActions';
import { Form, FormField, FormFooter } from '../utils/BsForm';
+import configs from '../../../../configs/project/client';
const validate = (values) => {
const errors = {};
@@ -24,6 +25,10 @@ const validate = (values) => {
errors.password = 'Required';
}
+ if (configs.recaptcha && !values.recaptcha) {
+ errors.recaptcha = 'Required';
+ }
+
return errors;
};
@@ -90,6 +95,12 @@ class RegisterForm extends Component {
type="password"
placeholder="Password"
/>
+