[FIX] google_recaptcha: remove autoinstall on google_recaptcha

You can enable it in base_setup when you need it.

Depends of base_setup and not ir_http or website because you need to
be able to enable it for login form e.g.

closes odoo/odoo#61520

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Jeremy Kersten
2020-11-09 09:27:23 +00:00
parent 4ebe8ccf00
commit 1669bf81eb
5 changed files with 20 additions and 17 deletions
@@ -34,7 +34,7 @@ class ResConfigSettings(models.TransientModel):
module_web_unsplash = fields.Boolean("Unsplash Image Library")
module_partner_autocomplete = fields.Boolean("Partner Autocomplete")
module_base_geolocalize = fields.Boolean("GeoLocalize")
module_google_recaptcha = fields.Boolean("reCAPTCHA: Easy on Humans, Hard on Bots")
module_google_recaptcha = fields.Boolean("reCAPTCHA")
report_footer = fields.Text(related="company_id.report_footer", string='Custom Report Footer', help="Footer text displayed at the bottom of all reports.", readonly=False)
group_multi_currency = fields.Boolean(string='Multi-Currencies',
implied_group='base.group_multi_currency',
@@ -370,7 +370,7 @@
<div class="o_setting_right_pane" id="website_recaptcha_settings">
<label for="module_google_recaptcha"/>
<div class="text-muted">
reCAPTCHA is a free service that protects your website from spam and abuse.
Protect your forms from spam and abuse.
</div>
<div class="content-group" attrs="{'invisible': [('module_google_recaptcha', '=', False)]}" id="recaptcha_warning">
<div class="mt16 text-warning"><strong>Save</strong> this page and come back here to set up reCaptcha.</div>
+1 -1
View File
@@ -13,5 +13,5 @@
'views/assets.xml',
'views/res_config_settings_view.xml',
],
'auto_install': True,
'auto_install': False,
}
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import requests
from odoo import _, api, fields, models
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
@@ -10,4 +8,10 @@ class ResConfigSettings(models.TransientModel):
recaptcha_public_key = fields.Char("Site Key", config_parameter='recaptcha_public_key', groups='base.group_system')
recaptcha_private_key = fields.Char("Secret Key", config_parameter='recaptcha_private_key', groups='base.group_system')
recaptcha_min_score = fields.Float("Minimum score", config_parameter='recaptcha_min_score', groups='base.group_system', default="0.5", help="Should be between 0.0 and 1.0")
recaptcha_min_score = fields.Float(
"Minimum score",
config_parameter='recaptcha_min_score',
groups='base.group_system',
default="0.5",
help="Should be between 0.0 and 1.0.\n1.0 is very likely a good interaction, 0.0 is very likely a bot"
)
@@ -5,23 +5,22 @@
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base_setup.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='website_recaptcha_settings']/div[hasclass('text-muted')]" position="inside">
<p>If no keys are provided, no checks will be done.</p>
</xpath>
<div id="recaptcha_warning" position="replace">
<div attrs="{'invisible': [('module_google_recaptcha', '=', False)]}">
<div class="content-group mt16">
<label for="recaptcha_public_key" class="o_light_label"/>
<div class="content-group" id="reacaptcha_configuration_settings" attrs="{'invisible': [('module_google_recaptcha', '=', False)]}">
<div class="mt16 row">
<label for="recaptcha_public_key" class="col-3 o_light_label"/>
<field name="recaptcha_public_key"/>
</div>
<div class="content-group">
<label for="recaptcha_private_key" class="o_light_label"/>
<label for="recaptcha_private_key" class="col-3 o_light_label"/>
<field name="recaptcha_private_key"/>
</div>
<div class="content-group">
<label for="recaptcha_min_score" class="o_light_label"/>
<label for="recaptcha_min_score" class="col-3 o_light_label"/>
<field name="recaptcha_min_score"/>
</div>
<div>
<a href="https://www.google.com/recaptcha/admin/create" class="oe_link" target="_blank">
<i class="fa fa-arrow-right"/> Generate site/secret keys for v3 reCaptcha type
<i class="fa fa-arrow-right"/> Generate reCAPTCHA v3 keys
</a>
</div>
</div>