diff --git a/cooperator_website_recaptcha/README.rst b/cooperator_website_recaptcha/README.rst new file mode 100644 index 000000000..766f80b09 --- /dev/null +++ b/cooperator_website_recaptcha/README.rst @@ -0,0 +1,79 @@ +============================= +Cooperators Website reCAPTCHA +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d7052e563ba6aefe735d7262009fd4f72301aa99b96f9e8945cf9960505c5b12 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcooperative-lightgray.png?logo=github + :target: https://github.com/OCA/cooperative/tree/16.0/cooperator_website_recaptcha + :alt: OCA/cooperative +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/cooperative-16-0/cooperative-16-0-cooperator_website_recaptcha + :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/cooperative&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Add Google Recaptcha to Subscription Request Form + +**Table of contents** + +.. contents:: + :local: + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Coop IT Easy SC + +Contributors +~~~~~~~~~~~~ + +* `Coop IT Easy SC `_: + + * Carmen Bianca Bakker + * hugues de keyzer + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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/cooperative `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/cooperator_website_recaptcha/__init__.py b/cooperator_website_recaptcha/__init__.py new file mode 100644 index 000000000..e046e49fb --- /dev/null +++ b/cooperator_website_recaptcha/__init__.py @@ -0,0 +1 @@ +from . import controllers diff --git a/cooperator_website_recaptcha/__manifest__.py b/cooperator_website_recaptcha/__manifest__.py new file mode 100644 index 000000000..baccc1b95 --- /dev/null +++ b/cooperator_website_recaptcha/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2022 Coop IT Easy SC +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Cooperators Website reCAPTCHA", + "summary": "Add reCAPTCHA to Subscription Request Form", + "version": "16.0.1.0.0", + "category": "Cooperative management", + "website": "https://github.com/OCA/cooperative", + "author": "Coop IT Easy SC, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + "cooperator_website", + "website_recaptcha_v2", + ], + "data": [ + "views/subscription_template.xml", + ], +} diff --git a/cooperator_website_recaptcha/controllers/__init__.py b/cooperator_website_recaptcha/controllers/__init__.py new file mode 100644 index 000000000..12a7e529b --- /dev/null +++ b/cooperator_website_recaptcha/controllers/__init__.py @@ -0,0 +1 @@ +from . import main diff --git a/cooperator_website_recaptcha/controllers/main.py b/cooperator_website_recaptcha/controllers/main.py new file mode 100644 index 000000000..f588bae88 --- /dev/null +++ b/cooperator_website_recaptcha/controllers/main.py @@ -0,0 +1,17 @@ +from odoo.http import request +from odoo.tools.translate import _ + +from odoo.addons.cooperator_website.controllers.main import WebsiteSubscription + + +class RecaptchaWebsiteSubscription(WebsiteSubscription): + def _additional_validate(self, kwargs, logged, values, post_file): + result = super()._additional_validate(kwargs, logged, values, post_file) + if result is not True: + return result + result, error_msg = request.website.is_recaptcha_v2_valid(kwargs) + if not result: + values["error_msg"] = _("Error validating the CAPTCHA: {0}").format( + error_msg + ) + return result diff --git a/cooperator_website_recaptcha/i18n/cooperator_website_recaptcha.pot b/cooperator_website_recaptcha/i18n/cooperator_website_recaptcha.pot new file mode 100644 index 000000000..d4b382f66 --- /dev/null +++ b/cooperator_website_recaptcha/i18n/cooperator_website_recaptcha.pot @@ -0,0 +1,56 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * cooperator_website_recaptcha +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: cooperator_website_recaptcha +#: model:ir.model.fields,field_description:cooperator_website_recaptcha.field_res_company__captcha_type +msgid "Captcha type or disabled" +msgstr "" + +#. module: cooperator_website_recaptcha +#: model:ir.model,name:cooperator_website_recaptcha.model_res_company +msgid "Companies" +msgstr "" + +#. module: cooperator_website_recaptcha +#: model:ir.model.fields.selection,name:cooperator_website_recaptcha.selection__res_company__captcha_type__none +msgid "Disabled" +msgstr "" + +#. module: cooperator_website_recaptcha +#: model:ir.model.fields,field_description:cooperator_website_recaptcha.field_res_company__display_name +msgid "Display Name" +msgstr "" + +#. module: cooperator_website_recaptcha +#: model:ir.model.fields.selection,name:cooperator_website_recaptcha.selection__res_company__captcha_type__google +msgid "Google Recaptcha" +msgstr "" + +#. module: cooperator_website_recaptcha +#: model:ir.model.fields,field_description:cooperator_website_recaptcha.field_res_company__id +msgid "ID" +msgstr "" + +#. module: cooperator_website_recaptcha +#: model:ir.model.fields,field_description:cooperator_website_recaptcha.field_res_company____last_update +msgid "Last Modified on" +msgstr "" + +#. module: cooperator_website_recaptcha +#: code:addons/cooperator_website_recaptcha/controllers/main.py:0 +#: code:addons/cooperator_website_recaptcha/controllers/main.py:0 +#, python-format +msgid "the captcha has not been validated, please fill in the captcha" +msgstr "" diff --git a/cooperator_website_recaptcha/readme/CONTRIBUTORS.rst b/cooperator_website_recaptcha/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..26771b9d2 --- /dev/null +++ b/cooperator_website_recaptcha/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Coop IT Easy SC `_: + + * Carmen Bianca Bakker + * hugues de keyzer diff --git a/cooperator_website_recaptcha/readme/DESCRIPTION.rst b/cooperator_website_recaptcha/readme/DESCRIPTION.rst new file mode 100644 index 000000000..e2d9bce47 --- /dev/null +++ b/cooperator_website_recaptcha/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Add Google Recaptcha to Subscription Request Form diff --git a/cooperator_website_recaptcha/static/description/index.html b/cooperator_website_recaptcha/static/description/index.html new file mode 100644 index 000000000..f20b06381 --- /dev/null +++ b/cooperator_website_recaptcha/static/description/index.html @@ -0,0 +1,425 @@ + + + + + + +Cooperators Website reCAPTCHA + + + +
+

Cooperators Website reCAPTCHA

+ + +

Beta License: AGPL-3 OCA/cooperative Translate me on Weblate Try me on Runboat

+

Add Google Recaptcha to Subscription Request Form

+

Table of contents

+ +
+

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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Coop IT Easy SC
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/cooperative project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/cooperator_website_recaptcha/views/subscription_template.xml b/cooperator_website_recaptcha/views/subscription_template.xml new file mode 100644 index 000000000..9e60054b5 --- /dev/null +++ b/cooperator_website_recaptcha/views/subscription_template.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/setup/cooperator_website_recaptcha/odoo/addons/cooperator_website_recaptcha b/setup/cooperator_website_recaptcha/odoo/addons/cooperator_website_recaptcha new file mode 120000 index 000000000..957701f6c --- /dev/null +++ b/setup/cooperator_website_recaptcha/odoo/addons/cooperator_website_recaptcha @@ -0,0 +1 @@ +../../../../cooperator_website_recaptcha \ No newline at end of file diff --git a/setup/cooperator_website_recaptcha/setup.py b/setup/cooperator_website_recaptcha/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/cooperator_website_recaptcha/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)