From 5e0108b1a2f2c224061e42ecd6fad47a67ad8b48 Mon Sep 17 00:00:00 2001 From: hugues de keyzer Date: Tue, 16 Jan 2024 10:56:37 +0100 Subject: [PATCH] [MIG] website_recaptcha_v2: migration to 16.0 --- website_recaptcha_v2/README.rst | 12 +-- website_recaptcha_v2/__manifest__.py | 2 +- website_recaptcha_v2/models/website.py | 3 +- .../static/description/index.html | 40 +++---- website_recaptcha_v2/tests/test_recaptcha.py | 9 +- .../views/res_config_settings_view.xml | 101 +++++++++--------- 6 files changed, 84 insertions(+), 83 deletions(-) diff --git a/website_recaptcha_v2/README.rst b/website_recaptcha_v2/README.rst index d81b248cc3..bb3b7e2f3b 100644 --- a/website_recaptcha_v2/README.rst +++ b/website_recaptcha_v2/README.rst @@ -7,7 +7,7 @@ Website reCAPTCHA v2 !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:7f93442702a45bbb8c73c99e3b4b0954f9ef93ea935012d7de96bf37ae5e76be + !! source digest: sha256:55856dbbdf9c9efc1b9b1ebbb33638a0018eda0d91bd6c8c9e30805aa8f2e5b0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -17,13 +17,13 @@ Website reCAPTCHA v2 :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github - :target: https://github.com/OCA/website/tree/12.0/website_recaptcha_v2 + :target: https://github.com/OCA/website/tree/16.0/website_recaptcha_v2 :alt: OCA/website .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/website-12-0/website-12-0-website_recaptcha_v2 + :target: https://translation.odoo-community.org/projects/website-16-0/website-16-0-website_recaptcha_v2 :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/website&target_branch=12.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/website&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -55,7 +55,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -101,6 +101,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/website `_ project on GitHub. +This module is part of the `OCA/website `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_recaptcha_v2/__manifest__.py b/website_recaptcha_v2/__manifest__.py index 9aba64b5b3..f8486bfc22 100644 --- a/website_recaptcha_v2/__manifest__.py +++ b/website_recaptcha_v2/__manifest__.py @@ -7,7 +7,7 @@ { "name": "Website reCAPTCHA v2", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "category": "Website", "depends": ["website"], "author": ( diff --git a/website_recaptcha_v2/models/website.py b/website_recaptcha_v2/models/website.py index 709b2af41a..7b6ddc77b9 100644 --- a/website_recaptcha_v2/models/website.py +++ b/website_recaptcha_v2/models/website.py @@ -11,6 +11,7 @@ from odoo import _, api, fields, models URL = "https://www.recaptcha.net/recaptcha/api/siteverify" +RECAPTCHA_API_TIMEOUT = 30 class Website(models.Model): @@ -52,7 +53,7 @@ def is_recaptcha_v2_valid(self, form_values): return (False, _("No response given.")) get_res = {"secret": self.recaptcha_v2_secret_key, "response": response} - res = requests.post(URL, data=get_res).json() + res = requests.post(URL, data=get_res, timeout=RECAPTCHA_API_TIMEOUT).json() error_msg = "\n".join( self._get_error_message(error) for error in res.get("error-codes", []) diff --git a/website_recaptcha_v2/static/description/index.html b/website_recaptcha_v2/static/description/index.html index 6a4df8dc42..7462acfab1 100644 --- a/website_recaptcha_v2/static/description/index.html +++ b/website_recaptcha_v2/static/description/index.html @@ -1,20 +1,20 @@ - + - + Website reCAPTCHA v2