Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions website_altcha/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

========================
Privacy Friendly Captcha
========================
Expand All @@ -17,7 +13,7 @@ Privacy Friendly Captcha
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github
Expand Down Expand Up @@ -126,6 +122,14 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-hbrunn| image:: https://github.com/hbrunn.png?size=40px
:target: https://github.com/hbrunn
:alt: hbrunn

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-hbrunn|

This module is part of the `OCA/website <https://github.com/OCA/website/tree/18.0/website_altcha>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
13 changes: 10 additions & 3 deletions website_altcha/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "Dixmit,Odoo Community Association (OCA)",
"maintainers": ["hbrunn"],
"website": "https://github.com/OCA/website",
"depends": [
"website",
],
"assets": {
"web.assets_frontend": [
"website_altcha/static/src/**/*.esm.js",
"website_altcha/static/src/**/*.xml",
"website_altcha/static/src/**/*.scss",
"website_altcha/static/src/*.esm.js",
"website_altcha/static/src/*.xml",
"website_altcha/static/src/*.scss",
],
"web.altcha_libs": [
"website_altcha/static/lib/altcha.js",
"website_altcha/static/lib/altcha-l10n.js",
"website_altcha/static/lib/altcha.css",
],
"web.assets_tests": [
"website_altcha/static/tests/tours/*.esm.js",
],
},
"external_dependencies": {
"python": ["altcha"],
Expand All @@ -31,4 +35,7 @@
"security/ir.model.access.csv",
"views/res_config_settings_views.xml",
],
"demo": [
"demo/website_page.xml",
],
}
36 changes: 36 additions & 0 deletions website_altcha/demo/website_page.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<odoo>
<template id="demo_page_view">
<t t-call="website.layout">
<form class="website_altcha_form">
<p>
This is a demo form for website_altcha. Note how it automatically inserts the widget in the container containing the submit button
</p>
<div>
<button type="submit">Submit</button>
</div>
</form>
<form class="website_altcha_form">
<p>
You can however also place the widget yourself and configure it according to the <a
href="https://altcha.org/docs/v2/widget-integration/#attribute-configuration"
>documentation</a>. In that case the <em
>website_altcha_form</em> class only takes care that the javascript code is loaded and activated.
</p>
<p>
Note in both cases, you'll have to verify the token you received in your custom controller.
</p>
<div>
<altcha-widget type="switch" />
</div>
<div>
<button type="submit">Submit</button>
</div>
</form>
</t>
</template>
<record id="demo_page" model="website.page">
<field name="url">/website_altcha_demo</field>
<field name="is_published" eval="True" />
<field name="view_id" ref="demo_page_view" />
</record>
</odoo>
30 changes: 13 additions & 17 deletions website_altcha/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Privacy Friendly Captcha</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="privacy-friendly-captcha">
<h1 class="title">Privacy Friendly Captcha</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="privacy-friendly-captcha">
<h1>Privacy Friendly Captcha</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:72f381043be58f2d2154c68ba7152e620c995760d9ce8280c5d49e161adbf924
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/website/tree/18.0/website_altcha"><img alt="OCA/website" src="https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/website-18-0/website-18-0-website_altcha"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/website&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/website/tree/18.0/website_altcha"><img alt="OCA/website" src="https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/website-18-0/website-18-0-website_altcha"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/website&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to use a Captcha System completly handled by Odoo.</p>
<p>It relies on Altcha (<a class="reference external" href="https://altcha.org">https://altcha.org</a>), an OpenSource captcha
alternative.</p>
Expand All @@ -393,7 +388,7 @@ <h1>Privacy Friendly Captcha</h1>
</ul>
</div>
<div class="section" id="use-cases-context">
<h2><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h1>
<p>Currently, Odoo provides 2 options:</p>
<ul class="simple">
<li>Google Recaptcha relies on tracking of the user. It implies cookies</li>
Expand All @@ -407,7 +402,7 @@ <h2><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h2>
to spend more CPU, making it costly at scale.</p>
</div>
<div class="section" id="configuration">
<h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
<p>Go to Configuration/Website, check “Enable Altcha” under “Privacy”. Some
extra parameters will appear with all the ALTCHA information. This
parameters are website dependent.</p>
Expand Down Expand Up @@ -436,23 +431,23 @@ <h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
</ul>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/website/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/website/issues/new?body=module:%20website_altcha%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>Dixmit</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.dixmit.com">Dixmit</a><ul>
<li>Enric Tobella</li>
Expand All @@ -462,19 +457,20 @@ <h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/hbrunn"><img alt="hbrunn" src="https://github.com/hbrunn.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/website/tree/18.0/website_altcha">OCA/website</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</div>
</body>
</html>
1 change: 0 additions & 1 deletion website_altcha/static/lib/altcha.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* @odoo-module */
const DEV = false;
var is_array = Array.isArray;
var index_of = Array.prototype.indexOf;
Expand Down
49 changes: 49 additions & 0 deletions website_altcha/static/src/altcha.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {loadBundle} from "@web/core/assets";
import {renderToString} from "@web/core/utils/render";
import {session} from "@web/session";

export const AltchaBaseFunctionality = {
altcha_prepend_to: "div.oe_login_buttons",
altcha_enabled: false,

altcha_init() {
this.altcha_enabled = Boolean(session.altcha_public_key);
},

/**
* Loads the altcha libraries.
*
* @returns {Promise|Boolean} promise if libs are loading else false if the altcha key is empty.
*/
async altcha_load_libs() {
if (this.altcha_enabled) {
this._altchaReady = loadBundle(`web.altcha_libs`);
return this._altchaReady;
}
return false;
},
altcha_insert_widget() {
if (this.altcha_enabled && !this.$el.find("altcha-widget").length) {
this.$el
.find(this.altcha_prepend_to)
.prepend(renderToString("website_altcha.AltchaWidget", {}));
}
},
};

export const AltchaLegacyClassFunctionality = {
...AltchaBaseFunctionality,
init() {
this._super(...arguments);
this.altcha_init();
},

async willStart() {
this.altcha_load_libs();
return this._super(...arguments);
},
start() {
this.altcha_insert_widget();
return this._super(...arguments);
},
};
27 changes: 0 additions & 27 deletions website_altcha/static/src/altcha/altcha.esm.js

This file was deleted.

9 changes: 9 additions & 0 deletions website_altcha/static/src/generic.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {AltchaLegacyClassFunctionality} from "@website_altcha/altcha.esm";
import publicWidget from "@web/legacy/js/public/public_widget";

publicWidget.registry.GenericAltcha = publicWidget.Widget.extend({
...AltchaLegacyClassFunctionality,
selector: "form.website_altcha_form, form.js_website_submit_form",
altcha_prepend_to:
"*:has( > input[type='submit']), *:has( > button[type='submit'])",
});
12 changes: 12 additions & 0 deletions website_altcha/static/src/signup.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {AltchaLegacyClassFunctionality} from "./altcha.esm";
import publicWidget from "@web/legacy/js/public/public_widget";

publicWidget.registry.SignupAltcha = publicWidget.Widget.extend({
...AltchaLegacyClassFunctionality,
selector: ".oe_signup_form",
});

publicWidget.registry.ResetPasswordAltcha = publicWidget.Widget.extend({
...AltchaLegacyClassFunctionality,
selector: ".oe_reset_password_form",
});
73 changes: 0 additions & 73 deletions website_altcha/static/src/signup/signup.esm.js

This file was deleted.

Loading
Loading