2 Commits

53 changed files with 253 additions and 1443 deletions

View File

@@ -1,20 +0,0 @@
# Configuration for known file extensions
[*.{css,js,json,less,md,py,rst,sass,scss,xml,yaml,yml}]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{json,yml,yaml,rst,md}]
indent_size = 2
# Do not configure editor for libs and autogenerated content
[{*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst}]
charset = unset
end_of_line = unset
indent_size = unset
indent_style = unset
insert_final_newline = false
trim_trailing_whitespace = false

View File

@@ -1,188 +0,0 @@
env:
browser: true
es6: true
# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
parserOptions:
ecmaVersion: 2019
overrides:
- files:
- "**/*.esm.js"
parserOptions:
sourceType: module
# Globals available in Odoo that shouldn't produce errorings
globals:
_: readonly
$: readonly
fuzzy: readonly
jQuery: readonly
moment: readonly
odoo: readonly
openerp: readonly
owl: readonly
luxon: readonly
# Styling is handled by Prettier, so we only need to enable AST rules;
# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890
rules:
accessor-pairs: warn
array-callback-return: warn
callback-return: warn
capitalized-comments:
- warn
- always
- ignoreConsecutiveComments: true
ignoreInlineComments: true
complexity:
- warn
- 15
constructor-super: warn
dot-notation: warn
eqeqeq: warn
global-require: warn
handle-callback-err: warn
id-blacklist: warn
id-match: warn
init-declarations: error
max-depth: warn
max-nested-callbacks: warn
max-statements-per-line: warn
no-alert: warn
no-array-constructor: warn
no-caller: warn
no-case-declarations: warn
no-class-assign: warn
no-cond-assign: error
no-const-assign: error
no-constant-condition: warn
no-control-regex: warn
no-debugger: error
no-delete-var: warn
no-div-regex: warn
no-dupe-args: error
no-dupe-class-members: error
no-dupe-keys: error
no-duplicate-case: error
no-duplicate-imports: error
no-else-return: warn
no-empty-character-class: warn
no-empty-function: error
no-empty-pattern: error
no-empty: warn
no-eq-null: error
no-eval: error
no-ex-assign: error
no-extend-native: warn
no-extra-bind: warn
no-extra-boolean-cast: warn
no-extra-label: warn
no-fallthrough: warn
no-func-assign: error
no-global-assign: error
no-implicit-coercion:
- warn
- allow: ["~"]
no-implicit-globals: warn
no-implied-eval: warn
no-inline-comments: warn
no-inner-declarations: warn
no-invalid-regexp: warn
no-irregular-whitespace: warn
no-iterator: warn
no-label-var: warn
no-labels: warn
no-lone-blocks: warn
no-lonely-if: error
no-mixed-requires: error
no-multi-str: warn
no-native-reassign: error
no-negated-condition: warn
no-negated-in-lhs: error
no-new-func: warn
no-new-object: warn
no-new-require: warn
no-new-symbol: warn
no-new-wrappers: warn
no-new: warn
no-obj-calls: warn
no-octal-escape: warn
no-octal: warn
no-param-reassign: warn
no-path-concat: warn
no-process-env: warn
no-process-exit: warn
no-proto: warn
no-prototype-builtins: warn
no-redeclare: warn
no-regex-spaces: warn
no-restricted-globals: warn
no-restricted-imports: warn
no-restricted-modules: warn
no-restricted-syntax: warn
no-return-assign: error
no-script-url: warn
no-self-assign: warn
no-self-compare: warn
no-sequences: warn
no-shadow-restricted-names: warn
no-shadow: warn
no-sparse-arrays: warn
no-sync: warn
no-this-before-super: warn
no-throw-literal: warn
no-undef-init: warn
no-undef: error
no-unmodified-loop-condition: warn
no-unneeded-ternary: error
no-unreachable: error
no-unsafe-finally: error
no-unused-expressions: error
no-unused-labels: error
no-unused-vars: error
no-use-before-define: error
no-useless-call: warn
no-useless-computed-key: warn
no-useless-concat: warn
no-useless-constructor: warn
no-useless-escape: warn
no-useless-rename: warn
no-void: warn
no-with: warn
operator-assignment: [error, always]
prefer-const: warn
radix: warn
require-yield: warn
sort-imports: warn
spaced-comment: [error, always]
strict: [error, function]
use-isnan: error
valid-jsdoc:
- warn
- prefer:
arg: param
argument: param
augments: extends
constructor: class
exception: throws
func: function
method: function
prop: property
return: returns
virtual: abstract
yield: yields
preferType:
array: Array
bool: Boolean
boolean: Boolean
number: Number
object: Object
str: String
string: String
requireParamDescription: false
requireReturn: false
requireReturnDescription: false
requireReturnType: false
valid-typeof: warn
yoda: warn

View File

@@ -1,42 +0,0 @@
#!/bin/bash
#
# Run the Python tests of the given Odoo modules.
#
# This script is meant to be executed *inside* an Elabore doodba image
# (docker.0k.io/mirror/odoo:rc_<version>-ELABORE-LIGHT), with a
# PostgreSQL service reachable at $PGHOST. The modules under test are
# read from the current working directory (the checked-out repository),
# which is prepended to the addons path so that the PR's code takes
# precedence over the modules already baked in the image.
#
# Usage: odoo-tests.sh <module1,module2,...>
set -euo pipefail
modules="${1:?usage: odoo-tests.sh <module1,module2,...>}"
export PGHOST=postgres
export PGUSER=odoo
export PGPASSWORD=odoopassword
export PGDATABASE="test_$(basename "$PWD" | tr '.-' '__')"
export WITHOUT_DEMO=all
export DB_FILTER='.*'
# Generate /opt/odoo/auto/odoo.conf from the environment and wait for
# the database to accept connections.
/opt/odoo/common/entrypoint
# Odoo test-tags format: "/module1,/module2" (one leading slash).
tags="/$(echo "$modules" | tr ',' ',/')"
exec odoo \
--config=/opt/odoo/auto/odoo.conf \
--max-cron-threads=0 \
--limit-time-real=10000 \
--workers=0 \
--test-enable \
--stop-after-init \
--addons-path="$PWD,/opt/odoo/auto/addons" \
-d "$PGDATABASE" \
-i "$modules" \
--test-tags "$tags"

View File

@@ -1,40 +0,0 @@
name: pre-commit
on:
pull_request:
jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: https://gitea.com/actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure --color=always
env:
# Consider valid a PR that changes README fragments but doesn't
# change the README.rst file itself. It's not really a problem
# because the bot will update it anyway after merge. This way, we
# lower the barrier for functional contributors that want to fix the
# readme fragments, while still letting developers get README
# auto-generated (which also helps functionals when using runboat).
# DOCS https://pre-commit.com/#temporarily-disabling-hooks
SKIP: oca-gen-addon-readme
- name: Check that all files generated by pre-commit are in git
run: |
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
if [ "$newfiles" != "" ] ; then
echo "Please check-in the following files:"
echo "$newfiles"
exit 1
fi

View File

@@ -1,79 +0,0 @@
name: tests
on:
pull_request:
branches:
- "16.0*"
workflow_dispatch:
jobs:
test:
runs-on: odoo-ci
container:
image: docker.0k.io/mirror/odoo:rc_16.0-ELABORE-LIGHT
services:
postgres:
image: docker.0k.io/postgres:17.2.0-myc
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoopassword
POSTGRES_DB: postgres
steps:
# The doodba image ships no Node.js, so actions/checkout@v4 cannot
# run here. The repository is private, so the job token is required.
- name: Checkout
env:
SECRET_GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eu
token="${GITEA_TOKEN:-${GITHUB_TOKEN:-${SECRET_GITEA_TOKEN:-${SECRET_GITHUB_TOKEN:-}}}}"
if [ -z "$token" ]; then
echo "::error::No job token available to clone the repository"
exit 1
fi
server="${GITHUB_SERVER_URL:-https://git.elabore.coop}"
repo="${GITHUB_REPOSITORY:?GITHUB_REPOSITORY is not set}"
ref="${GITHUB_REF:-${GITHUB_SHA:?neither GITHUB_REF nor GITHUB_SHA is set}}"
auth_url="$(printf '%s' "${server%/}/${repo}.git" |
sed -E "s#^https://#https://${token}@#")"
git init -q .
git config --global --add safe.directory "$PWD"
git remote add origin "$auth_url"
git fetch -q --depth=1 origin "$ref"
git checkout -q FETCH_HEAD
- name: Detect changed modules
id: changed
run: |
set -eu
if [ -n "${GITHUB_BASE_REF:-}" ]; then
git fetch -q --depth=1 origin "refs/heads/$GITHUB_BASE_REF"
base_rev="FETCH_HEAD"
scope="diff against $GITHUB_BASE_REF"
else
base_rev=""
scope="all installable modules (manual run)"
fi
if [ -n "$base_rev" ]; then
modules="$(
git diff --name-only "$base_rev" HEAD |
awk -F/ '{print $1}' | sort -u |
while read -r dir; do
[ -f "$dir/__manifest__.py" ] && echo "$dir"
done | paste -sd, -
)"
else
modules="$(
for dir in */; do
dir="${dir%/}"
[ -f "$dir/__manifest__.py" ] && echo "$dir"
done | paste -sd, -
)"
fi
echo "modules=$modules" >> "$GITHUB_OUTPUT"
echo "Modules to test ($scope): ${modules:-<none>}"
- name: Run Odoo tests
if: steps.changed.outputs.modules != ''
run: bash .gitea/scripts/odoo-tests.sh "${{ steps.changed.outputs.modules }}"

88
.gitignore vendored
View File

@@ -1,88 +0,0 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
/.venv
/.pytest_cache
/.ruff_cache
# C extensions
*.so
# Distribution / packaging
.Python
env/
bin/
build/
develop-eggs/
dist/
eggs/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
*.eggs
# Windows installers
*.msi
# Debian packages
*.deb
# Redhat packages
*.rpm
# MacOS packages
*.dmg
*.pkg
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
# Pycharm
.idea
# Eclipse
.settings
# Visual Studio cache/options directory
.vs/
.vscode
# OSX Files
.DS_Store
# Django stuff:
*.log
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Rope
.ropeproject
# Sphinx documentation
docs/_build/
# Backup files
*~
*.swp
# OCA rules
!static/lib/

View File

@@ -1,147 +0,0 @@
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
# END NOT INSTALLABLE ADDONS
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
# We don't want to mess with tool-generated files
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|^eslint.config.cjs|^prettier.config.cjs|
# Maybe reactivate this when all README files include prettier ignore tags?
^README\.md$|
# Library files can have extraneous formatting (even minimized)
/static/(src/)?lib/|
# Repos using Sphinx to generate docs don't need prettying
^docs/_templates/.*\.html$|
# Don't bother non-technical authors with formatting issues in docs
readme/.*\.(rst|md)$|
# Ignore build and dist directories in addons
/build/|/dist/|
# Ignore test files in addons
/tests/samples/.*|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)
default_language_version:
python: python3
node: "16.17.0"
repos:
- repo: local
hooks:
# These files are most likely copier diff rejection junks; if found,
# review them manually, fix the problem (if needed) and remove them
- id: forbidden-files
name: forbidden files
entry: found forbidden files; remove them
language: fail
files: "\\.rej$"
- id: en-po-files
name: en.po files cannot exist
entry: found a en.po file
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/oca/maintainer-tools
rev: f9b919b9868143135a9c9cb03021089cabba8223
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
- id: oca-fix-manifest-website
entry:
bash -c 'oca-fix-manifest-website "https://git.elabore.coop/elabore/$(basename
$(git rev-parse --show-toplevel))"'
- id: oca-gen-addon-readme
entry:
bash -c 'oca-gen-addon-readme --addons-dir=. --branch=$(git symbolic-ref
refs/remotes/origin/HEAD | sed "s@^refs/remotes/origin/@@")
--repo-name=$(basename $(git rev-parse --show-toplevel)) --org-name="Elabore"
--if-source-changed --keep-source-digest'
- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.1.4
hooks:
- id: oca-checks-odoo-module
- id: oca-checks-po
args:
- --disable=po-pretty-format
- repo: local
hooks:
- id: prettier
name: prettier (with plugin-xml)
entry: prettier
args:
- --write
- --list-different
- --ignore-unknown
types: [text]
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
language: node
additional_dependencies:
- "prettier@2.7.1"
- "@prettier/plugin-xml@2.2.0"
- repo: local
hooks:
- id: eslint
name: eslint
entry: eslint
args:
- --color
- --fix
verbose: true
types: [javascript]
language: node
additional_dependencies:
- "eslint@8.24.0"
- "eslint-plugin-jsdoc@"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: end-of-file-fixer
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: debug-statements
- id: fix-encoding-pragma
args: ["--remove"]
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
# exclude files where underlines are not distinguishable from merge conflicts
exclude: /README\.rst$|^docs/.*\.rst$
- id: check-symlinks
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.7
hooks:
- id: docformatter
args: [
"--in-place", # modify the files
"--recursive", # run on all the files
"--wrap-summaries",
"88", # max length of 1st line
"--wrap-descriptions",
"88", # max length of other lines
"--pre-summary-newline", # new line before a long summary
"--make-summary-multi-line", # force summary on multilines
]
additional_dependencies: ["tomli"] # if Python <3.11
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/OCA/pylint-odoo
rev: v9.1.3
hooks:
- id: pylint_odoo
name: pylint with optional checks
args:
- --rcfile=.pylintrc
- --exit-zero
verbose: true
- id: pylint_odoo
args:
- --rcfile=.pylintrc-mandatory

View File

@@ -1,8 +0,0 @@
# Defaults for all prettier-supported languages.
# Prettier will complete this with settings from .editorconfig file.
bracketSpacing: false
printWidth: 88
proseWrap: always
semi: true
trailingComma: "es5"
xmlWhitespaceSensitivity: "strict"

123
.pylintrc
View File

@@ -1,123 +0,0 @@
[MASTER]
load-plugins=pylint_odoo
score=n
[ODOOLINT]
readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest-required-authors=Elabore
manifest-required-keys=license
manifest-deprecated-keys=description,active
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid-odoo-versions=16.0
[MESSAGES CONTROL]
disable=all
# This .pylintrc contains optional AND mandatory checks and is meant to be
# loaded in an IDE to have it check everything, in the hope this will make
# optional checks more visible to contributors who otherwise never look at a
# green travis to see optional checks that failed.
# .pylintrc-mandatory containing only mandatory checks is used the pre-commit
# config as a blocking check.
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
development-status-allowed,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-required-author,
manifest-required-key,
manifest-version-format,
method-compute,
method-inverse,
method-required-super,
method-search,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
attribute-string-redundant,
character-not-valid-in-resource-link,
consider-merging-classes-inherited,
context-overridden,
create-user-wo-reset-password,
dangerous-filter-wo-user,
dangerous-qweb-replace-wo-priority,
deprecated-data-xml-node,
deprecated-openerp-xml-node,
duplicate-po-message-definition,
except-pass,
file-not-used,
invalid-commit,
manifest-maintainers-list,
missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
old-api7-method-defined,
po-msgstr-variables,
po-syntax-error,
renamed-field-parameter,
resource-not-exist,
str-format-used,
test-folder-imported,
translation-contains-variable,
translation-positional-used,
unnecessary-utf8-coding-comment,
website-manifest-key-not-valid-uri,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute,
external-request-timeout,
# messages that do not cause the lint step to fail
consider-merging-classes-inherited,
create-user-wo-reset-password,
dangerous-filter-wo-user,
deprecated-module,
file-not-used,
invalid-commit,
missing-manifest-dependency,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
redefined-builtin,
too-complex,
unnecessary-utf8-coding-comment
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

View File

@@ -1,98 +0,0 @@
[MASTER]
load-plugins=pylint_odoo
score=n
[ODOOLINT]
readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest-required-authors=Elabore
manifest-required-keys=license
manifest-deprecated-keys=description,active
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid-odoo-versions=16.0
[MESSAGES CONTROL]
disable=all
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
development-status-allowed,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-required-author,
manifest-required-key,
manifest-version-format,
method-compute,
method-inverse,
method-required-super,
method-search,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
attribute-string-redundant,
character-not-valid-in-resource-link,
consider-merging-classes-inherited,
context-overridden,
create-user-wo-reset-password,
dangerous-filter-wo-user,
dangerous-qweb-replace-wo-priority,
deprecated-data-xml-node,
deprecated-openerp-xml-node,
duplicate-po-message-definition,
except-pass,
file-not-used,
invalid-commit,
manifest-maintainers-list,
missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
old-api7-method-defined,
po-msgstr-variables,
po-syntax-error,
renamed-field-parameter,
resource-not-exist,
str-format-used,
test-folder-imported,
translation-contains-variable,
translation-positional-used,
unnecessary-utf8-coding-comment,
website-manifest-key-not-valid-uri,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute,
external-request-timeout
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

View File

@@ -1,31 +0,0 @@
target-version = "py310"
fix = true
[lint]
extend-select = [
"B",
"C90",
"E501", # line too long (default 88)
"I", # isort
"UP", # pyupgrade
]
extend-safe-fixes = ["UP008"]
exclude = ["setup/*"]
[format]
exclude = ["setup/*"]
[lint.per-file-ignores]
"__init__.py" = ["F401", "I001"] # ignore unused and unsorted imports in __init__.py
"__manifest__.py" = ["B018"] # useless expression
[lint.isort]
section-order = ["future", "standard-library", "third-party", "odoo", "odoo-addons", "first-party", "local-folder"]
[lint.isort.sections]
"odoo" = ["odoo"]
"odoo-addons" = ["odoo.addons"]
[lint.mccabe]
max-complexity = 16

View File

@@ -18,7 +18,7 @@ None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/auth-tools/issues>`_. In case of
Bugs are tracked on `our issues website <https://github.com/elabore-coop/auth_remove_space_in_login/issues>`_. In case of
trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.
@@ -30,7 +30,6 @@ Contributors
------------
* Boris Gallet - `Email<mailto:boris.gallet@elabore.coop>` - `Github<https://github.com/b0g>`
* Stéphan Sainléger - `Github<https://github.com/stephansainleger>`
Funders
-------
@@ -42,4 +41,4 @@ The development of this module has been financially supported by:
Maintainer
----------
This module is maintained by Elabore.
This module is maintained by Elabore.

View File

@@ -3,7 +3,7 @@
{
"name": "auth_remove_space_in_signup_and_login",
"version": "16.0.1.0.0",
"version": "12.0.1.0.0",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Boris Gallet",

View File

@@ -1,13 +1,16 @@
# -*- coding: utf-8 -*-
import logging
from odoo.addons.auth_signup.controllers.main import AuthSignupHome
from odoo.http import request
class AuthSignupHome(AuthSignupHome):
def get_auth_signup_qcontext(self):
qcontext = super().get_auth_signup_qcontext()
qcontext = super(AuthSignupHome, self).get_auth_signup_qcontext()
if request.params.get("email"):
qcontext["email"] = request.params.get("email").strip()
if request.params.get("login"):
qcontext["login"] = request.params.get("login").strip()
return qcontext
return qcontext

View File

@@ -1,11 +1,14 @@
# -*- coding: utf-8 -*-
import logging
from odoo.addons.web.controllers.main import Home
from odoo import http
from odoo.addons.auth_signup.controllers.main import AuthSignupHome as Home
from odoo.http import request
class Home(Home):
@http.route()
@http.route('/web/login', type='http', auth="none", sitemap=False)
def web_login(self, *args, **kw):
if request.httprequest.method == "POST" and request.params.get("login"):
request.params["login"] = request.params.get("login").strip()
return super().web_login(*args, **kw)
if request.httprequest.method == 'POST':
if request.params.get("login"):
request.params["login"] = request.params.get("login").strip()
return super(Home, self).web_login(*args, **kw)

View File

@@ -1,61 +0,0 @@
===========================================================
Signup: email verification and split names compatibility
===========================================================
Compatibility layer between ``auth_signup_verify_email`` and
``partner_firstname``.
Problem
=======
``auth_signup_verify_email`` implements a passwordless signup flow that
calls ``res.users.signup()`` directly with the raw request values. When a
signup form posts ``firstname`` and ``lastname`` instead of ``name`` (as
forms relying on ``partner_firstname`` commonly do), the core
``_create_user_from_template()`` guard rejects the request with
``Signup: no name or partner given for new user``.
This module is installed automatically as soon as both
``auth_signup_verify_email`` and ``partner_firstname`` are installed. It
derives ``name`` from ``firstname``/``lastname`` before the core guard
runs. ``partner_firstname`` still computes the final partner name from the
split fields, so the stored name keeps the configured order.
Installation
============
Install ``auth_signup_verify_email`` and ``partner_firstname``. This
module is installed automatically; no manual step is required.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://git.elabore.coop/Elabore/auth-tools/issues>`_. In case of
trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Stéphan Sainléger - `Email<mailto:stephan.sainleger@elabore.coop>` - `Github<https://github.com/stephansainleger>`
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -1 +0,0 @@
from . import models

View File

@@ -1,23 +0,0 @@
# Copyright 2026 Elabore
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Signup: email verification and split names compatibility",
"summary": "Keep passwordless signup compatible with split first and last names",
"version": "16.0.1.0.0",
"author": "Elabore",
"website": "https://git.elabore.coop/elabore/auth-tools",
"maintainer": "Stéphan Sainléger",
"license": "AGPL-3",
"category": "Tools",
"depends": [
"auth_signup_verify_email",
"partner_firstname",
],
"data": [],
"demo": [],
"installable": True,
# Install automatically when both compatibility dependencies are installed.
"auto_install": True,
"application": False,
}

View File

@@ -1 +0,0 @@
from . import res_users

View File

@@ -1,53 +0,0 @@
# Copyright 2026 Elabore
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
class ResUsers(models.Model):
"""
Bridge passwordless signup with split first and last names.
"""
_inherit = "res.users"
@api.model
def _get_signup_name(self, values):
"""
Build a name from the split signup name fields.
:param dict values: signup values containing optional ``firstname``
and ``lastname`` entries.
:return: the joined non-empty name parts, or ``False`` when both
parts are empty.
"""
parts = [
part.strip()
for part in (values.get("firstname"), values.get("lastname"))
if part and part.strip()
]
return " ".join(parts) or False
@api.model
def _signup_create_user(self, values):
"""
Fill ``name`` before the core signup guard runs.
``auth_signup_verify_email`` sends the raw signup request values to
``res.users.signup()`` without preparing them through the signup
controller. When the form posts ``firstname``/``lastname`` instead
of ``name`` (as ``partner_firstname`` forms do), the core
``_create_user_from_template()`` guard rejects the request. Derive
``name`` here so the guard passes; ``partner_firstname`` still
computes the final partner name from the split fields.
:param dict values: signup values forwarded by ``res.users.signup``.
:return: the created user record.
:raises ValueError: propagated from the core guard when no name can
be derived and no partner is provided.
"""
if not values.get("name") and not values.get("partner_id"):
name = self._get_signup_name(values)
if name:
values["name"] = name
return super()._signup_create_user(values)

View File

@@ -1 +0,0 @@
from . import test_signup

View File

@@ -1,97 +0,0 @@
# Copyright 2026 Elabore
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from unittest.mock import patch
from odoo import http
from odoo.tests import HttpCase, TransactionCase, tagged
from odoo.addons.mail.models import mail_template
@tagged("post_install", "-at_install")
class TestSignupName(TransactionCase):
"""
Test the name derivation at the res.users signup boundary.
"""
def setUp(self):
"""
Enable free signup for the test cases.
"""
super().setUp()
if "website" in self.env:
self.env["website"].get_current_website().auth_signup_uninvited = "b2c"
self.env["ir.config_parameter"].sudo().set_param(
"auth_signup.invitation_scope", "b2c"
)
def test_signup_create_user_from_split_name(self):
"""
Create a user from firstname/lastname without an explicit name.
"""
user = self.env["res.users"]._signup_create_user(
{
"login": "split.name@example.com",
"email": "split.name@example.com",
"firstname": "Jean",
"lastname": "Dupont",
"password": "",
}
)
self.assertEqual(user.firstname, "Jean")
self.assertEqual(user.lastname, "Dupont")
self.assertTrue(user.name)
def test_signup_create_user_without_name_still_fails(self):
"""
Keep the core guard when no name information is available.
"""
with self.assertRaises(ValueError):
self.env["res.users"]._signup_create_user(
{
"login": "nameless@example.com",
"email": "nameless@example.com",
"password": "",
}
)
@tagged("post_install", "-at_install")
class TestPasswordlessSignup(HttpCase):
"""
Test the full auth_signup_verify_email passwordless flow.
"""
def setUp(self):
"""
Enable free signup on the website and in the signup settings.
"""
super().setUp()
if "website" in self.env:
self.env["website"].get_current_website().auth_signup_uninvited = "b2c"
self.env["ir.config_parameter"].sudo().set_param(
"auth_signup.invitation_scope", "b2c"
)
def test_passwordless_signup_with_split_name(self):
"""
Create a user from the passwordless form with split names.
"""
self.authenticate(None, None)
payload = {
"csrf_token": http.Request.csrf_token(self),
"login": "contributors@odoo-community.org",
"firstname": "Jean",
"lastname": "Dupont",
}
with patch.object(mail_template.MailTemplate, "send_mail"):
self.url_open("/web/signup", data=payload)
user = (
self.env["res.users"]
.sudo()
.search([("login", "=", "contributors@odoo-community.org")])
)
self.assertTrue(user)
self.assertEqual(user.firstname, "Jean")
self.assertEqual(user.lastname, "Dupont")

View File

@@ -1,14 +1,14 @@
===============
signup_recaptcha
signup_form_honeypot
===============
google recaptcha V2 for signup
add a honeypot field to trap simple bots
Installation
============
Use Odoo normal module installation procedure to install
``signup_recaptcha``.
``signup_form_honeypot``.
Known issues / Roadmap
======================
@@ -18,7 +18,7 @@ None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/signup_recaptcha/issues>`_. In case of
Bugs are tracked on `our issues website <https://github.com/elabore-coop/signup_form_honeypot/issues>`_. In case of
trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.
@@ -29,7 +29,7 @@ Credits
Contributors
------------
* Boris Gallet - `Email<mailto:boris.gallet@elabore.coop>` - `Github<https://github.com/b0g>`
* `Elabore <mailto:laetitia.dacosta@elabore.coop>`
Funders
-------

View File

@@ -0,0 +1 @@
from . import controllers

View File

@@ -0,0 +1,34 @@
# Copyright 2024 Elabore ()
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "signup_form_honeypot",
"version": "12.0.1.0.0",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Elabore",
"license": "AGPL-3",
"category": "",
"summary": "add a honeypot field to trap simple bots",
# any module necessary for this one to work correctly
"depends": [
"base","auth_signup"
],
"qweb": [],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
"views/auth_signup_views.xml",
],
# only loaded in demonstration mode
"demo": [],
"js": [],
"css": [],
"installable": True,
# Install this module automatically if all dependency have been previously
# and independently installed. Used for synergetic or glue modules.
"auto_install": False,
"application": False,
}

View File

@@ -0,0 +1,2 @@
from . import auth_signup

View File

@@ -0,0 +1,32 @@
from odoo import http
from odoo.addons.auth_signup.controllers.main import AuthSignupHome
from odoo.http import request
import uuid
class AuthSignupHoneypot(AuthSignupHome):
def _get_honeypot_name(self):
""" Génère dynamiquement le nom du champ honeypot """
return str(uuid.uuid4()).replace('-', '')
@http.route(['/web/signup'], type='http', auth='public', website=True, sitemap=False)
def web_auth_signup(self, *args, **kw):
""" Surcharge de la méthode pour inclure le champ honeypot dynamique """
honeypot_name = request.session.get('honeypot_name','')
if honeypot_name == '':
honeypot_name = self._get_honeypot_name()
request.session['honeypot_name'] = honeypot_name
response = super(AuthSignupHoneypot, self).web_auth_signup(*args, **kw)
response.qcontext['honeypot_name'] = honeypot_name
return response
def do_signup(self, qcontext):
""" Vérifie le champ honeypot avant de créer le compte """
honeypot_name = request.session.get('honeypot_name', '')
honeypot_field = request.params.get(honeypot_name, '')
if honeypot_field:
return http.local_redirect('/web/login', keep_hash=True)
# Si le champ n'est pas rempli, continuer avec l'inscription normale
super(AuthSignupHoneypot, self).do_signup(qcontext)

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="signup_honeypot_inherit" inherit_id="auth_signup.signup">
<xpath expr="//form" position="inside">
<input t-att-name="honeypot_name"
type="text"
style="border:#ffffff;"
autocomplete="off"
tabindex="-1" />
</xpath>
</template>
</odoo>

View File

@@ -0,0 +1,44 @@
====================
signup_form_honeypot
====================
add a honeypot field to trap simple bots
Installation
============
Use Odoo normal module installation procedure to install
``signup_form_honeypot``.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/signup_form_honeypot/issues>`_. In case of
trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.
Credits
=======
Contributors
------------
* `Elabore <mailto:laetitia.dacosta@elabore.coop>`
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -0,0 +1 @@
from . import controllers

View File

@@ -0,0 +1,34 @@
# Copyright 2024 Elabore ()
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "signup_form_timestamp",
"version": "12.0.1.0.0",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Elabore",
"license": "AGPL-3",
"category": "",
"summary": "add a timestamp to trap simple bots",
# any module necessary for this one to work correctly
"depends": [
"base","auth_signup"
],
"qweb": [],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
"views/auth_signup_views.xml",
],
# only loaded in demonstration mode
"demo": [],
"js": [],
"css": [],
"installable": True,
# Install this module automatically if all dependency have been previously
# and independently installed. Used for synergetic or glue modules.
"auto_install": False,
"application": False,
}

View File

@@ -0,0 +1,2 @@
from . import auth_signup

View File

@@ -0,0 +1,59 @@
from odoo import http
from odoo.addons.auth_signup.controllers.main import AuthSignupHome
from odoo.http import request
import uuid
from datetime import datetime
class AuthSignupTimestamp(AuthSignupHome):
MIN_SIGNUP_DELAY = 5
MAX_SIGNUP_DELAY = 3600
def _get_field_timestamp_name(self):
""" Génère dynamiquement le nom du champ timestamp """
return str(uuid.uuid4()).replace('-', '')
@http.route(['/web/signup'], type='http', auth='public', website=True, sitemap=False)
def web_auth_signup(self, *args, **kw):
""" Surcharge de la méthode pour inclure le champ timestamp dynamique """
timestamp_name = request.session.get('timestamp_name','')
if timestamp_name == '':
timestamp_name = self._get_field_timestamp_name()
request.session['timestamp_name'] = timestamp_name
# Générer un timestamp actuel
signup_timestamp = request.session.get('signup_timestamp','')
if signup_timestamp == '':
signup_timestamp = int(datetime.now().timestamp())
request.session['signup_timestamp'] = signup_timestamp
response = super(AuthSignupTimestamp, self).web_auth_signup(*args, **kw)
response.qcontext['signup_timestamp'] = signup_timestamp
response.qcontext['timestamp_name'] = timestamp_name
return response
def do_signup(self, qcontext):
""" Vérifie le timestamp avant de créer le compte """
timestamp_name = request.session.get('timestamp_name', '')
signup_timestamp = request.params.get(timestamp_name,'')
if not signup_timestamp:
return http.local_redirect('/web/login', keep_hash=True)
try:
# Convertir en entier
signup_timestamp = int(signup_timestamp)
current_timestamp = int(datetime.now().timestamp())
elapsed_time = current_timestamp - signup_timestamp
# Vérifier si le délai est acceptable
if elapsed_time < self.MIN_SIGNUP_DELAY or elapsed_time > self.MAX_SIGNUP_DELAY:
return http.local_redirect('/web/login', keep_hash=True)
except ValueError:
# Si le timestamp n'est pas valide
return http.local_redirect('/web/login', keep_hash=True)
# Si le champ n'est pas rempli, continuer avec l'inscription normale
super(AuthSignupTimestamp, self).do_signup(qcontext)

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="signup_honeypot_timestamp" inherit_id="auth_signup.signup">
<xpath expr="//form" position="inside">
<input type="hidden" t-att-name="timestamp_name" t-att-value="signup_timestamp"/>
</xpath>
</template>
</odoo>

View File

@@ -1,2 +0,0 @@
from . import controllers
from . import models

View File

@@ -1,24 +0,0 @@
# Copyright 2024 Boris Gallet ()
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "signup_recaptcha",
"version": "16.0.1.0.0",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Boris Gallet",
"license": "AGPL-3",
"category": "Tools",
"summary": "google recaptcha V2 for signup form with server side validation",
# any module necessary for this one to work correctly
"depends": ["base", "portal"],
"data": [
"views/auth_signup.xml",
"views/res_config.xml",
],
"installable": True,
# Install this module automatically if all dependency have been previously
# and independently installed. Used for synergetic or glue modules.
"auto_install": False,
"application": False,
}

View File

@@ -1,3 +0,0 @@
## package holder
from . import main

View File

@@ -1,42 +0,0 @@
import logging
from odoo.addons.auth_signup.controllers.main import AuthSignupHome
from odoo.addons.auth_signup.models.res_users import SignupError
from odoo.http import request
from odoo import _
_logger = logging.getLogger(__name__)
class AuthSignupHome(AuthSignupHome):
def get_auth_signup_qcontext(self):
"""Add recaptcha to the context"""
qcontext = super(AuthSignupHome, self).get_auth_signup_qcontext()
if request.params.get("g-recaptcha-response"):
qcontext["g-recaptcha-response"] = request.params.get(
"g-recaptcha-response"
)
return qcontext
def do_signup(self, qcontext):
"""Validate the captcha before signup"""
## Check if g-recaptcha-response is in the context
_logger.debug("qcontext: %s", qcontext.get("g-recaptcha-response"))
if "g-recaptcha-response" not in qcontext:
_logger.debug("No captcha in context")
# FIXME The qcontext error message is not displayed
qcontext["error"] = _("the captcha has not been validated")
raise SignupError(_("the captcha has not been validated"))
# Validate the captcha
if not request.env["portal.mixin"].is_captcha_valid(
qcontext.get("g-recaptcha-response")
):
qcontext["error"] = _("the captcha is not valid")
raise SignupError(_("the captcha is not valid"))
# If the captcha is valid, call the parent method
super(AuthSignupHome, self).do_signup(qcontext)

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
</data>
</odoo>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- vim:fdn=3:
-->
<odoo>
<data>
<template id="assets_backend" name="signup_recaptcha assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/signup_recaptcha/static/src/css/main.css"/>
<script type="text/javascript" src="/signup_recaptcha/static/src/js/main.js"></script>
</xpath>
</template>
</data>
</odoo>

View File

@@ -1,94 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * signup_recaptcha
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 10:21+0000\n"
"PO-Revision-Date: 2025-01-02 10:21+0000\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: signup_recaptcha
#: model_terms:ir.ui.view,arch_db:signup_recaptcha.res_config_settings_view_form
msgid "<i class=\"fa fa-arrow-right\"/>\n"
" How to get my reCaptcha Key"
msgstr ""
#. module: signup_recaptcha
#: model:ir.model,name:signup_recaptcha.model_res_config_settings
msgid "Config Settings"
msgstr "Paramètres de configuration"
#. module: signup_recaptcha
#: model:ir.model,name:signup_recaptcha.model_portal_mixin
msgid "Portal Mixin"
msgstr ""
#. module: signup_recaptcha
#: model_terms:ir.ui.view,arch_db:signup_recaptcha.res_config_settings_view_form
msgid "Portal reCaptcha"
msgstr ""
#. module: signup_recaptcha
#: model:ir.model.fields,field_description:signup_recaptcha.field_res_config_settings__recaptcha_key_secret
msgid "Recaptcha Key Secret"
msgstr "Clé secrete Recaptcha"
#. module: signup_recaptcha
#: model:ir.model.fields,field_description:signup_recaptcha.field_res_config_settings__recaptcha_key_site
msgid "Recaptcha Key Site"
msgstr "Clé du site Recaptcha"
#. module: signup_recaptcha
#: code:addons/signup_recaptcha/models/portal_mixin.py:20
#, python-format
msgid "The response parameter is invalid or malformed."
msgstr "Le paramètre de réponse est invalide ou mal formatté"
#. module: signup_recaptcha
#: code:addons/signup_recaptcha/models/portal_mixin.py:19
#, python-format
msgid "The response parameter is missing."
msgstr "Le paramètre de réponse est manquant"
#. module: signup_recaptcha
#: code:addons/signup_recaptcha/models/portal_mixin.py:18
#, python-format
msgid "The secret parameter is invalid or malformed."
msgstr "La clé secrete est invalide ou mal formattée "
#. module: signup_recaptcha
#: code:addons/signup_recaptcha/models/portal_mixin.py:17
#, python-format
msgid "The secret parameter is missing."
msgstr "la clé secrete est manquante"
#. module: signup_recaptcha
#: code:addons/signup_recaptcha/models/portal_mixin.py:24
#, python-format
msgid "There was a problem with the captcha entry."
msgstr "Il y a eu un problème avec le captcha"
#. module: signup_recaptcha
#: model_terms:ir.ui.view,arch_db:signup_recaptcha.res_config_settings_view_form
msgid "XXXXX"
msgstr ""
#. module: signup_recaptcha
#: code:addons/signup_recaptcha/controllers/main.py:32
#, python-format
msgid "the captcha has not been validated"
msgstr "le captcha n’a pas été validé"
#. module: signup_recaptcha
#: code:addons/signup_recaptcha/controllers/main.py:39
#, python-format
msgid "the captcha is not valid"
msgstr "Le captcha n’est pas valide"

View File

@@ -1,4 +0,0 @@
# Copyright 2004 Tech-Receptives Solutions Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import res_config
from . import portal_mixin

View File

@@ -1,44 +0,0 @@
# Copyright 2019 Simone Orsi - Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import requests
from odoo import _, api, models
from odoo.exceptions import ValidationError
URL = "https://www.google.com/recaptcha/api/siteverify"
class PortalMixin(models.AbstractModel):
_inherit = "portal.mixin"
@api.model
def _get_error_message(self, errorcode=None):
mapping = {
"missing-input-secret": _("The secret parameter is missing."),
"invalid-input-secret": _("The secret parameter is invalid or malformed."),
"missing-input-response": _("The response parameter is missing."),
"invalid-input-response": _(
"The response parameter is invalid or malformed."
),
}
return mapping.get(errorcode, _("There was a problem with the captcha entry."))
def is_captcha_valid(self, response):
recaptcha_key_secret = (
self.env["ir.config_parameter"]
.sudo()
.get_param("signup_recaptcha.recaptcha_key_secret")
)
get_res = {"secret": recaptcha_key_secret, "response": response}
res = requests.post(URL, data=get_res).json()
error_msg = "\n".join(
self._get_error_message(error) for error in res.get("error-codes", [])
)
if error_msg:
raise ValidationError(error_msg)
if not res.get("success"):
raise ValidationError(self._get_error_message())
return True

View File

@@ -1,12 +0,0 @@
from odoo import fields, models
class PortalConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
recaptcha_key_site = fields.Char(
config_parameter="signup_recaptcha.recaptcha_key_site"
)
recaptcha_key_secret = fields.Char(
config_parameter="signup_recaptcha.recaptcha_key_secret"
)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -1,14 +0,0 @@
<section class="oe_container">
<div class="oe_row">
<h2 class="oe_slogan">Odoo Signup reCAPTCHA </h2>
<h4 class="oe_slogan"><a href="https://www.techreceptives.com">By Elabore, inspired by CampToCamp</a></h4>
<p>
This modules allows you to integrate Google reCAPTCHA v2.0 to signup forms. You can configure your Google
reCAPTCHA site and public keys in "Settings" -> "Website Settings".
</p>
<div class="oe_row_img oe_centered oe_mt32">
<img class="oe_picture oe_screenshot" src="recaptcha_setting.png" />
</div>
</div>
</section>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template id="auth_signup_recaptcha" inherit_id="auth_signup.fields" name="Recaptcha for signup">
<xpath expr="//div[hasclass('field-confirm_password')]" position="after">
<script src="https://www.google.com/recaptcha/api.js" />
<div
class="g-recaptcha text-xs-center"
t-att-data-sitekey="request.env['ir.config_parameter'].sudo().get_param('signup_recaptcha.recaptcha_key_site')"
name="recaptcha_key_site"
/>
</xpath>
</template>
</data>
</odoo>

View File

@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">Portal settings</field>
<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[@name='integration']" position="after">
<h2>Portal reCaptcha</h2>
<div class="row o_settings_container mt16">
<div class="col-12 col-lg-6 o_setting_box" id="reCaptcha_setting">
<div class="o_setting_right_pane">
<div class="row">
<label
class="o_light_label col-lg-5"
for="recaptcha_key_site"
/>
<field name="recaptcha_key_site" placeholder="XXXXX" />
</div>
<div class="row">
<label
class="o_light_label col-lg-5"
for="recaptcha_key_secret"
/>
<field
name="recaptcha_key_secret"
placeholder="XXXXX"
/>
</div>
<div>
<a
role="button"
class="btn-link"
target="_blank"
href="http://www.google.com/recaptcha/admin"
>
<i class="fa fa-arrow-right" />
How to get my reCaptcha Key
</a>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>