* = base_setup, website_form, website_sale, website_crm, crm_iap_lead_website, website_hr_recruitment, website_mass_mailing Integrate reCaptchaV3 on website_form submit and website_mass_mailing subscription. You can now use ReCaptchaV3 to add reCaptcha verification in any module using google_recaptcha. Also added a better error management on the form with custom messages. task-2217980 closes odoo/odoo#48466 Related: odoo/enterprise#9649 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
19 lines
687 B
Python
19 lines
687 B
Python
# -*- coding: utf-8 -*-
|
|
import json
|
|
|
|
from odoo import http
|
|
from odoo.addons.website_form.controllers.main import WebsiteForm
|
|
from odoo.http import request
|
|
|
|
|
|
class ContactController(WebsiteForm):
|
|
|
|
def _handle_website_form(self, model_name, **kwargs):
|
|
if model_name == 'crm.lead':
|
|
# Add the ip_address to the request in order to add this to the lead
|
|
# that will be created. With this, we avoid to create a lead from
|
|
# reveal if a lead is already created from the contact form.
|
|
request.params['reveal_ip'] = request.httprequest.remote_addr
|
|
|
|
return super(ContactController, self)._handle_website_form(model_name, **kwargs)
|