diff --git a/.eslintrc.js b/.eslintrc.js
index a4e6f2f2a..ea9ee2a4f 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -31,6 +31,7 @@ module.exports = {
'_': true,
'jQuery': true,
'tainacan_extra_components': true,
- 'tainacan_extra_plugins': true
+ 'tainacan_extra_plugins': true,
+ 'grecaptcha': true
}
}
\ No newline at end of file
diff --git a/src/views/admin/js/axios.js b/src/views/admin/js/axios.js
index e0a514ac1..1b500c5c0 100644
--- a/src/views/admin/js/axios.js
+++ b/src/views/admin/js/axios.js
@@ -97,5 +97,6 @@ wp.interceptors.response.use(
export const CancelToken = axios.CancelToken;
export const isCancel = axios.isCancel;
export const all = axios.all;
+export const axiosCreate = axios.create;
-export default { tainacan, wp, CancelToken, isCancel, all };
\ No newline at end of file
+export default { tainacan, wp, CancelToken, isCancel, all, axiosCreate };
\ No newline at end of file
diff --git a/src/views/admin/js/store/modules/item/actions.js b/src/views/admin/js/store/modules/item/actions.js
index e78d91469..0ee6294ea 100644
--- a/src/views/admin/js/store/modules/item/actions.js
+++ b/src/views/admin/js/store/modules/item/actions.js
@@ -384,4 +384,21 @@ export const finishItemSubmission = ({ commit }, { itemSubmission, fakeItemId })
});
});
});
+}
+
+export const verifyCaptcha = ({ commit }, { secret, response }) => {
+ return new Promise((resolve, reject) => {
+
+ // New axios instance
+ const googleReCaptcha = axios.axiosCreate({
+ baseURL: 'https://www.google.com/recaptcha/api/'
+ });
+
+ googleReCaptcha.post('/verify/', { secret: secret, response: response })
+ .then( res => {
+ resolve( res.data );
+ }).catch( error => {
+ reject(error);
+ });
+ });
}
\ No newline at end of file
diff --git a/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php b/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php
index 495ce8bcd..5e20bd898 100644
--- a/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php
+++ b/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php
@@ -178,6 +178,13 @@ function tainacan_blocks_register_tainacan_item_submission_form(){
array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
);
+ wp_register_script(
+ 'google-recaptcha-script',
+ 'https://www.google.com/recaptcha/api.js',
+ [], false, true
+ );
+ wp_enqueue_script('google-recaptcha-script');
+
wp_register_style(
'item-submission-form',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-item-submission-form.css',
diff --git a/src/views/item-submission/pages/item-submission-form.vue b/src/views/item-submission/pages/item-submission-form.vue
index 9c2620f7d..5cc97851a 100644
--- a/src/views/item-submission/pages/item-submission-form.vue
+++ b/src/views/item-submission/pages/item-submission-form.vue
@@ -320,6 +320,14 @@
v-html="formHooks['item']['end-right'].join('')"/>
+
+
+
+
+
+