diff --git a/website_form_recaptcha/README.rst b/website_form_recaptcha/README.rst index ecacb9cd20..088698f350 100755 --- a/website_form_recaptcha/README.rst +++ b/website_form_recaptcha/README.rst @@ -30,7 +30,7 @@ Look at `website_crm_recaptcha` module for example implementation .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/186/9.0 + :target: https://runbot.odoo-community.org/runbot/186/10.0 Known Issues / Road Map diff --git a/website_form_recaptcha/__init__.py b/website_form_recaptcha/__init__.py index 90010a71f1..8d018e90a1 100755 --- a/website_form_recaptcha/__init__.py +++ b/website_form_recaptcha/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2015 LasLabs Inc. +# Copyright 2015-2017 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/website_form_recaptcha/__manifest__.py b/website_form_recaptcha/__manifest__.py index 3a7df64cd9..beb3864841 100644 --- a/website_form_recaptcha/__manifest__.py +++ b/website_form_recaptcha/__manifest__.py @@ -1,17 +1,17 @@ # -*- coding: utf-8 -*- -# © 2016-TODAY LasLabs Inc. +# Copyright 2016-2017 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Website Form - ReCaptcha", "summary": 'Provides a ReCaptcha field for Website Forms', - "version": "9.0.1.0.0", + "version": "10.0.1.0.0", "category": "Website", "website": "https://laslabs.com/", - "author": "LasLabs, Odoo Community Association", + "author": "LasLabs, Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, - 'installable': False, + 'installable': True, "depends": [ "website_form", ], diff --git a/website_form_recaptcha/controllers/__init__.py b/website_form_recaptcha/controllers/__init__.py index 2210962ee5..091bc73898 100755 --- a/website_form_recaptcha/controllers/__init__.py +++ b/website_form_recaptcha/controllers/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2016-TODAY LasLabs Inc. +# Copyright 2016-2017 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import main diff --git a/website_form_recaptcha/controllers/main.py b/website_form_recaptcha/controllers/main.py index 384b28324d..8d39e1ef28 100755 --- a/website_form_recaptcha/controllers/main.py +++ b/website_form_recaptcha/controllers/main.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2016-TODAY LasLabs Inc. +# Copyright 2016-2017 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import http @@ -27,9 +27,9 @@ def recaptcha_public(self): ), }) - def extract_data(self, model, **kwargs): + def extract_data(self, model, values): """ Inject ReCaptcha validation into pre-existing data extraction """ - res = super(WebsiteForm, self).extract_data(model, **kwargs) + res = super(WebsiteForm, self).extract_data(model, values) if model.website_form_recaptcha: captcha_obj = request.env['website.form.recaptcha'] ip_addr = request.httprequest.environ.get('HTTP_X_FORWARDED_FOR') @@ -39,7 +39,7 @@ def extract_data(self, model, **kwargs): ip_addr = request.httprequest.remote_addr try: captcha_obj.action_validate( - kwargs.get(captcha_obj.RESPONSE_ATTR), ip_addr + values.get(captcha_obj.RESPONSE_ATTR), ip_addr ) except ValidationError: raise ValidationError([captcha_obj.RESPONSE_ATTR]) diff --git a/website_form_recaptcha/data/ir_config_parameter_data.xml b/website_form_recaptcha/data/ir_config_parameter_data.xml index 74bfe07b85..7627d20bd8 100644 --- a/website_form_recaptcha/data/ir_config_parameter_data.xml +++ b/website_form_recaptcha/data/ir_config_parameter_data.xml @@ -1,8 +1,8 @@ diff --git a/website_form_recaptcha/models/__init__.py b/website_form_recaptcha/models/__init__.py index c0b99f422e..3f679d1d57 100644 --- a/website_form_recaptcha/models/__init__.py +++ b/website_form_recaptcha/models/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2015 LasLabs Inc. +# Copyright 2015-2017 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import ir_model diff --git a/website_form_recaptcha/models/ir_model.py b/website_form_recaptcha/models/ir_model.py index 59c49c1021..7683242880 100644 --- a/website_form_recaptcha/models/ir_model.py +++ b/website_form_recaptcha/models/ir_model.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2015 LasLabs Inc. +# Copyright 2015-2017 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields diff --git a/website_form_recaptcha/models/website_form_recaptcha.py b/website_form_recaptcha/models/website_form_recaptcha.py index 1705c0d027..5db5d8a634 100644 --- a/website_form_recaptcha/models/website_form_recaptcha.py +++ b/website_form_recaptcha/models/website_form_recaptcha.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2015 LasLabs Inc. +# Copyright 2015-2017 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, api diff --git a/website_form_recaptcha/static/src/js/field_recaptcha.js b/website_form_recaptcha/static/src/js/field_recaptcha.js index 2500c45ad7..f4a7a7dc70 100644 --- a/website_form_recaptcha/static/src/js/field_recaptcha.js +++ b/website_form_recaptcha/static/src/js/field_recaptcha.js @@ -1,34 +1,33 @@ -/* © 2016-TODAY LasLabs Inc. +/* Copyright 2016-2017 LasLabs Inc. * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ odoo.define('website_form_recaptcha.recaptcha', function(require){ - "use strict"; - - var snippet_animation = require('web_editor.snippets.animation'); - var $ = require("$"); - - snippet_animation.registry.form_builder_send = snippet_animation.registry.form_builder_send.extend({ - - start: function() { - var self = this; - this._super(); - this.$captchas = self.$('.o_website_form_recaptcha'); - $.ajax({ - url: '/website/recaptcha/', - method: 'GET', - success: function(data){ - data = JSON.parse(data); - self.$captchas.append($( - '
' - )); - if (self.$captchas.length) { - $.getScript('https://www.google.com/recaptcha/api.js'); - } - }, - }); - } - - }); - + "use strict"; + + var snippet_animation = require('web_editor.snippets.animation'); + + snippet_animation.registry.form_builder_send = snippet_animation.registry.form_builder_send.extend({ + + start: function() { + var self = this; + this._super(); + this.$captchas = self.$('.o_website_form_recaptcha'); + $.ajax({ + url: '/website/recaptcha/', + method: 'GET', + success: function(data){ + data = JSON.parse(data); + self.$captchas.append($( + '' + )); + if (self.$captchas.length) { + $.getScript('https://www.google.com/recaptcha/api.js'); + } + }, + }); + } + + }); + }); diff --git a/website_form_recaptcha/tests/__init__.py b/website_form_recaptcha/tests/__init__.py index dbbda6c37f..49530f11d3 100644 --- a/website_form_recaptcha/tests/__init__.py +++ b/website_form_recaptcha/tests/__init__.py @@ -1,2 +1,4 @@ # -*- coding: utf-8 -*- +# Copyright 2016-2017 LasLabs Inc. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). from . import test_captcha diff --git a/website_form_recaptcha/tests/test_captcha.py b/website_form_recaptcha/tests/test_captcha.py index 8308c2f611..8fa159f030 100644 --- a/website_form_recaptcha/tests/test_captcha.py +++ b/website_form_recaptcha/tests/test_captcha.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2015-TODAY LasLabs Inc. +# Copyright 2015-2017 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp.tests.common import TransactionCase diff --git a/website_form_recaptcha/views/assets.xml b/website_form_recaptcha/views/assets.xml index 07d96d6bbb..50a28b8b39 100644 --- a/website_form_recaptcha/views/assets.xml +++ b/website_form_recaptcha/views/assets.xml @@ -1,8 +1,8 @@