summaryrefslogtreecommitdiff
path: root/addons/website_form/static
diff options
context:
space:
mode:
authorNasreddin (bon) <bon@odoo.com>2021-02-17 14:53:26 +0000
committerNasreddin (bon) <bon@odoo.com>2021-02-18 09:39:12 +0000
commiteb9373522628fa01c3503fa802ded23adc1cbe1f (patch)
tree18409da85905932a40575aba734eefff588efd2a /addons/website_form/static
parentf363103632ae7a5a034e6ff62689ce9c14fca6e2 (diff)
[FIX] website_sale, *: display error message in "Extra Info" step
*: google_recaptcha, website_form Issue - Install 'Ecommerce' module - In settings, fill the "reCAPTCHA: Easy on Humans, Hard on Bots" option with random wrong site key and secret key - Open your ecommerce (go to /shop ) - Add any product to cart and and open cart - Activate "Customize -> Extra Step Option" - Process to "Extra Info" step - Click on next Stuck at this step since next button does not react. Cause There is an error due to re-captcha feature that does not allowed to go to next step. The second issue is that the error is not displayed because missing message area in form. Solution Do not check recaptcha if 's_website_form_no_recaptcha' class present in form. Add span 's_website_form_result' to display error messages. Replace 'public' by 'site' in error message to fit google 'field' name. opw-2456098 closes odoo/odoo#66382 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/website_form/static')
-rw-r--r--addons/website_form/static/src/snippets/s_website_form/000.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/addons/website_form/static/src/snippets/s_website_form/000.js b/addons/website_form/static/src/snippets/s_website_form/000.js
index 3cb891a3069..ef45f11fc97 100644
--- a/addons/website_form/static/src/snippets/s_website_form/000.js
+++ b/addons/website_form/static/src/snippets/s_website_form/000.js
@@ -155,13 +155,16 @@ odoo.define('website_form.s_website_form', function (require) {
form_values[$(this).find('input').attr('name')] = date.format(format);
});
- const tokenObj = await this._recaptcha.getToken('website_form');
- if (tokenObj.token) {
- form_values['recaptcha_token_response'] = tokenObj.token;
- } else if (tokenObj.error) {
- self.update_status('error', tokenObj.error);
- return false;
+ if (!this.$target[0].classList.contains('s_website_form_no_recaptcha')) {
+ const tokenObj = await this._recaptcha.getToken('website_form');
+ if (tokenObj.token) {
+ form_values['recaptcha_token_response'] = tokenObj.token;
+ } else if (tokenObj.error) {
+ self.update_status('error', tokenObj.error);
+ return false;
+ }
}
+
// Post form and handle result
ajax.post(this.$target.attr('action') + (this.$target.data('force_action') || this.$target.data('model_name')), form_values)
.then(function (result_data) {