Browse Source
Feature/optional recaptcha (#109 )
* Recaptcha option
* Captcha showing only if option active
* Using website.recaptcha_key_site as active flag
* Restored breaklines
* Captcha flag set to company
* Added vim and Pycharm files to .gitignore
* PEP8 in company.py
* Missing space
* Recaptcha option
* Captcha showing only if option active
* Using website.recaptcha_key_site as active flag
* Restored breaklines
* Added vim and Pycharm files to .gitignore
* Captcha flag set to company
* PEP8 in company.py
* Missing space
* TODO for overloaded func added
* Recaptcha option
* Captcha showing only if option active
* Using website.recaptcha_key_site as active flag
* Restored breaklines
* Added vim and Pycharm files to .gitignore
* Captcha flag set to company
* PEP8 in company.py
* Missing space
* TODO for overloaded func added
* Recaptcha option
* Captcha showing only if option active
* Restored breaklines
* Captcha flag set to company
* Removed blank line
pull/73/head
César López Ramírez
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
57 additions and
23 deletions
.gitignore
easy_my_coop_website/__init__.py
easy_my_coop_website/__manifest__.py
easy_my_coop_website/controllers/main.py
easy_my_coop_website/models/__init__.py
easy_my_coop_website/models/company.py
easy_my_coop_website/views/res_company_view.xml
easy_my_coop_website/views/subscription_template.xml
@ -1,3 +1,6 @@
.idea/
*.swp
# Byte-compiled / optimized / DLL files
# Byte-compiled / optimized / DLL files
__pycache__/
__pycache__/
*.py[cod]
*.py[cod]
@ -1 +1,2 @@
from . import controllers
from . import controllers
from . import models
@ -5,7 +5,7 @@
{
{
" name " : " Easy My Coop Website " ,
" name " : " Easy My Coop Website " ,
" version " : " 12.0.1.0.0 " ,
" version " : " 12.0.1.0.3 " ,
" depends " : [ " easy_my_coop " , " website " , " website_recaptcha_reloaded " ] ,
" depends " : [ " easy_my_coop " , " website " , " website_recaptcha_reloaded " ] ,
" author " : " Coop IT Easy SCRLfs " ,
" author " : " Coop IT Easy SCRLfs " ,
" category " : " Cooperative management " ,
" category " : " Cooperative management " ,
@ -17,6 +17,7 @@
""" ,
""" ,
" data " : [
" data " : [
" views/subscription_template.xml " ,
" views/subscription_template.xml " ,
" views/res_company_view.xml " ,
" data/website_cooperator_data.xml " ,
" data/website_cooperator_data.xml " ,
] ,
] ,
" installable " : True ,
" installable " : True ,
@ -255,7 +255,8 @@ class WebsiteSubscription(http.Controller):
is_company = True
is_company = True
redirect = " easy_my_coop_website.becomecompanycooperator "
redirect = " easy_my_coop_website.becomecompanycooperator "
email = kwargs . get ( " company_email " )
email = kwargs . get ( " company_email " )
# TODO: Use a overloaded function with the captcha implementation
if request . website . company_id . captcha_type == ' google ' :
if (
if (
" g-recaptcha-response " not in kwargs
" g-recaptcha-response " not in kwargs
or kwargs [ " g-recaptcha-response " ] == " "
or kwargs [ " g-recaptcha-response " ] == " "
@ -0,0 +1 @@
from . import company
@ -0,0 +1,9 @@
from odoo import fields , models
class ResCompany ( models . Model ) :
_inherit = ' res.company '
captcha_type = fields . Selection ( [
( ' none ' , ' Disabled ' ) ,
( ' google ' , ' Google Recaptcha ' ) ,
] , ' Captcha type or disabled ' , required = True , default = ' google ' )
@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo >
<record model= "ir.ui.view" id= "view_company_inherit_captcha" >
<field name= "name" > res.company.form.captcha.easymy.coop</field>
<field name= "inherit_id" ref= "easy_my_coop.view_company_inherit_form2" />
<field name= "model" > res.company</field>
<field name= "arch" type= "xml" >
<field name= "internal_rules_approval_text" position= "after" >
<field name= "captcha_type" />
</field>
</field>
</record>
</odoo>
@ -473,7 +473,9 @@
<table style= "margin-left:195px" >
<table style= "margin-left:195px" >
<tr >
<tr >
<td width= "80%" >
<td width= "80%" >
<!-- TODO: Use a overloaded function with the captcha implementation ! -->
<div class= "g-recaptcha"
<div class= "g-recaptcha"
t-if="website.company_id.captcha_type == 'google'"
t-att-data-sitekey="website.recaptcha_key_site"
t-att-data-sitekey="website.recaptcha_key_site"
data-theme="green"/>
data-theme="green"/>
<br />
<br />
@ -971,7 +973,9 @@
<table style= "margin-left:195px" >
<table style= "margin-left:195px" >
<tr >
<tr >
<td width= "80%" >
<td width= "80%" >
<!-- TODO: Use a overloaded function with the captcha implementation ! -->
<div class= "g-recaptcha"
<div class= "g-recaptcha"
t-if="website.company_id.captcha_type == 'google'"
t-att-data-sitekey="website.recaptcha_key_site"
t-att-data-sitekey="website.recaptcha_key_site"
data-theme="green"/>
data-theme="green"/>
<br />
<br />