summaryrefslogtreecommitdiff
path: root/addons/website_mass_mailing/controllers
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2021-01-29 11:27:02 +0000
committerqsm-odoo <qsm@odoo.com>2021-02-03 10:55:19 +0000
commit82b188a090aa34c258840343cbf594969489dd6b (patch)
tree53e653f51818a765643b5bf8a9a6f947fd70bfe8 /addons/website_mass_mailing/controllers
parent0311cffd89c375a6fc1babacaa19029776bfebfb (diff)
[FIX] website_mass_mailing, *: add fix for missing google_recaptcha
*: website In 14.0, the website_mass_mailing now uses ReCaptcha. The problem is that we forgot to add the related module as a dependency. It thus works on runbot because it is indirectly installed by other apps but the newsletter popup does not work anymore if only website_mass_mailing is installed. In master, we simply fixed the dependency. For 14.0, we use this workaround as a fix: if the recaptcha is not installed as not found in the list of services in odoo.__DEBUG__, then we make sure the newsletter popup work without it. In edit mode, we now also display a warning which allows to fix the issue directly (by installing recaptcha). closes odoo/odoo#65263 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/website_mass_mailing/controllers')
-rw-r--r--addons/website_mass_mailing/controllers/main.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/website_mass_mailing/controllers/main.py b/addons/website_mass_mailing/controllers/main.py
index 60383155e80..ff25f92cc61 100644
--- a/addons/website_mass_mailing/controllers/main.py
+++ b/addons/website_mass_mailing/controllers/main.py
@@ -26,7 +26,12 @@ class MassMailController(MassMailController):
@route('/website_mass_mailing/subscribe', type='json', website=True, auth="public")
def subscribe(self, list_id, email, **post):
- if not request.env['ir.http']._verify_request_recaptcha_token('website_mass_mailing_subscribe'):
+ # FIXME the 14.0 was released with this but without the google_recaptcha
+ # module being added as a dependency of the website_mass_mailing module.
+ # This is to be fixed in master of course but in stable, we'll have to
+ # use this workaround.
+ if hasattr(request.env['ir.http'], '_verify_request_recaptcha_token') \
+ and not request.env['ir.http']._verify_request_recaptcha_token('website_mass_mailing_subscribe'):
return {
'toast_type': 'danger',
'toast_content': _("Suspicious activity detected by Google reCaptcha."),