Skip to content

[18.0][ADD] website_altcha#1175

Open
etobella wants to merge 2 commits into
OCA:18.0from
dixmit:18.0-add-website_altcha
Open

[18.0][ADD] website_altcha#1175
etobella wants to merge 2 commits into
OCA:18.0from
dixmit:18.0-add-website_altcha

Conversation

@etobella
Copy link
Copy Markdown
Member

This module allows to use a Captcha System completly handled by Odoo.

It relies on Altcha, an OpenSource captcha alternative.

Currently, Odoo provides 2 options:

  • Google Recaptcha relies on tracking of the user. It implies cookies
  • Cloudfare Turnstile relies on signals of the browser so it is less
    RGDP problematic. However, it relies on a third party infrastructure.
    The decision is made from a probabilistic perspective (likely a human)

With this new module, everything relies on our own system with no
cookies, no tracking and no network calls.

The way to solve it is to add a deterministic puzzle to solve. Bots need
to spend more CPU, making it costly at scale.

@etobella etobella force-pushed the 18.0-add-website_altcha branch from 71aadf4 to 842051e Compare April 15, 2026 07:28
Copy link
Copy Markdown

@luisDIXMIT luisDIXMIT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am testing on runboat, system params are setted but I don't understand why it gives me "Verification failed. Try again later." error. I am doing it from "contact us" page on website.
image

@etobella etobella force-pushed the 18.0-add-website_altcha branch from 842051e to d4f3616 Compare April 15, 2026 08:25
@etobella
Copy link
Copy Markdown
Member Author

The problem is that it requires https to work. If you change to https it should work (tested in runboat). In local there is not such a limitation when using localhost (only on localhost)

@luisDIXMIT
Copy link
Copy Markdown

The problem is that it requires https to work. If you change to https it should work (tested in runboat). In local there is not such a limitation when using localhost (only on localhost)

It works, thanks!

Copy link
Copy Markdown

@luisDIXMIT luisDIXMIT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review and tested on runboat, LGTM!

@etobella etobella force-pushed the 18.0-add-website_altcha branch from d4f3616 to 916c261 Compare April 15, 2026 10:49
@etobella etobella force-pushed the 18.0-add-website_altcha branch from 916c261 to 41da999 Compare April 24, 2026 13:55
@etobella
Copy link
Copy Markdown
Member Author

I made a major change, allowing to configure this for each website (much simpler to handle)

@etobella etobella force-pushed the 18.0-add-website_altcha branch 3 times, most recently from ad3850b to 7e766f4 Compare April 29, 2026 15:57
Copy link
Copy Markdown
Member

@hbrunn hbrunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funny, I just came here to propose this for version 16, but as yours has seniority, I'll backport this instead when done.

Do you think the module could have an init hook that enables it for all websites? Seems a bit nonsensical for users to have to do this manually, as they'll install the module because they want to have it, right?

Comment thread website_altcha/models/website.py Outdated
Comment on lines +42 to +45
("SCRYPT", "SCRYPT (memory hard)"),
]
if argon2:
result.append(("ARGON2ID", "ARGON2ID (memory hard, recommended)"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those two aren't included in the JS file, so I don't see how those choices can work (and expectedly selecting scrypt doesn't work on runbot). I think it's fine to remove them for version 1

@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_altcha_key,access_altcha_key,website_altcha.model_altcha_key,base.group_user,1,0,0,0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
access_altcha_key,access_altcha_key,website_altcha.model_altcha_key,base.group_user,1,0,0,0
access_altcha_key,access_altcha_key,website_altcha.model_altcha_key,base.group_system,1,0,0,0

as all access to this is sudo'd, no need for users to have access, right?

Comment thread website_altcha/readme/DESCRIPTION.md Outdated
@@ -0,0 +1,15 @@
This module allows to use a Captcha System completly handled by Odoo.

It relies on Altcha, an OpenSource captcha alternative.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It relies on Altcha, an OpenSource captcha alternative.
It relies on Altcha (https://altcha.org), an OpenSource captcha alternative.

Comment thread website_altcha/readme/DESCRIPTION.md Outdated
Comment on lines +5 to +12
Currently, Odoo provides 2 options:

- Google Recaptcha relies on tracking of the user. It implies cookies
- Cloudfare Turnstile relies on signals of the browser so it is less RGDP problematic.
However, it relies on a third party infrastructure.
The decision is made from a probabilistic perspective (likely a human)

With this new module, everything relies on our own system with no cookies, no tracking and no network calls.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can go to CONTEXT.md I think

Comment thread website_altcha/readme/CONFIGURE.md Outdated
Comment on lines +12 to +13
- Memory Hard: `SCRYPT`
- Memory Hard (it required argon2-cffi): `ARGON2ID`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

Comment thread website_altcha/__manifest__.py Outdated
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Website Friendly Captcha",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"name": "Website Friendly Captcha",
"name": "Privacy Friendly Captcha",

the point is that this is privacy friendly and self hosted, not friendly as in nice i think

Comment thread website_altcha/__manifest__.py Outdated

{
"name": "Website Friendly Captcha",
"summary": """Use Friendly Captcha for verifying users""",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"summary": """Use Friendly Captcha for verifying users""",
"summary": """Use self hosted privacy friendly captcha for verifying website users are not bots""",

Comment thread website_altcha/readme/CONFIGURE.md Outdated
@@ -0,0 +1,16 @@
On each website, some extra parameters will appear with all the altcha information
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should start with: Go to Configuration/Website, check "Enable Altcha" under "Privacy"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, and they style their name ALTCHA, so I suggest to s/Altcha/ALTCHA in all user visible texts

@etobella etobella force-pushed the 18.0-add-website_altcha branch 2 times, most recently from cc2abba to 449f19d Compare May 29, 2026 07:36
@etobella
Copy link
Copy Markdown
Member Author

@hbrunn All comments attended.

Copy link
Copy Markdown
Member

@hbrunn hbrunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, what do you think about activating this on installation though?

and I just tried to test password reset and signup on runbot, here the widget shows an error even though it works fine for the contact form. any idea what's going on there?

* @param {String} action
* @returns {Promise|Object}
*/
async getToken(action) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you point me to where this function is used?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it comes from the first implementation. I will remove it.

this.$el
.find("div.oe_login_buttons")
.prepend(
'<altcha-widget class="pb-2 o_altcha_widget" challengeurl="/altcha"></altcha-widget>'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etobella this seems to be the problem, why not render here website_altcha.AltchaWidget?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw in my version I named the controller /website_altcha/challenge to scope stuff with the module name

return this._super(...arguments);
},
start: function () {
if (this._altcha._publicKey && !this.$el.find(".altcha-widget").length) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (this._altcha._publicKey && !this.$el.find(".altcha-widget").length) {
if (this._altcha._publicKey && !this.$el.find(".o_altcha-widget").length) {

@etobella etobella force-pushed the 18.0-add-website_altcha branch from 449f19d to a10d885 Compare May 29, 2026 11:49
@etobella
Copy link
Copy Markdown
Member Author

I am not confident about the pre_init change.

It might happend that your customer is already using a recaptcha system, so forcing it mitght be a problem.

Copy link
Copy Markdown
Member

@hbrunn hbrunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough, then we leave it like that. do you need this to be three commits or can it be just one?

@OCA-git-bot
Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@etobella etobella force-pushed the 18.0-add-website_altcha branch from a10d885 to 2118c0f Compare May 29, 2026 13:37
@etobella
Copy link
Copy Markdown
Member Author

2 because there is 2 different authors 😉

@hbrunn
Copy link
Copy Markdown
Member

hbrunn commented May 29, 2026

thanks

/ocabot merge nobump

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 18.0-ocabot-merge-pr-1175-by-hbrunn-bump-nobump, awaiting test results.

@OCA-git-bot
Copy link
Copy Markdown
Contributor

@hbrunn The merge process could not be finalized, because command twine upload --disable-progress-bar --non-interactive --repository-url https://upload.pypi.org/legacy/ -u __token__ odoo_addon_website_altcha-18.0.1.0.0.3-py3-none-any.whl failed with output:

Uploading distributions to https://upload.pypi.org/legacy/
Uploading odoo_addon_website_altcha-18.0.1.0.0.3-py3-none-any.whl
�[33mWARNING �[0m Error during upload. Retry with the --verbose option for more details. 
�[31mERROR   �[0m HTTPError: 429 Too Many Requests from https://upload.pypi.org/legacy/  
         Too Many Requests                                                      

@etobella
Copy link
Copy Markdown
Member Author

I will try tomorrow... the problem with pypi...

Copy link
Copy Markdown
Member

@tarteo tarteo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, tested it locally! Only nitpicking so code LGTM!

publicWidget.registry.SignupAltcha = publicWidget.Widget.extend({
...AltchaFunctionality,
selector: ".oe_signup_form",
tokenName: "signup",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokenName is never used.

Comment thread website_altcha/README.rst

- Google Recaptcha relies on tracking of the user. It implies cookies
- Cloudfare Turnstile relies on signals of the browser so it is less
RGDP problematic. However, it relies on a third party infrastructure.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean GDPR?


class AltchaKey(models.Model):
_name = "altcha.key"
_description = "Altcha Key" # TODO
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is TODO here? I think it can be removed.

Copy link
Copy Markdown
Member

@hbrunn hbrunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as you have to touch this anyways again for the typo, I added a few UI things I came across when backporting this to v16

<field
name="altcha_algorithm"
required="altcha_enabled"
placeholder="00000000-0000-0000-0000-000000000000"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
placeholder="00000000-0000-0000-0000-000000000000"

<div class="mt16" invisible="not altcha_enabled">
<label
class="col-md-3 o_light_label"
string="Tracking ID"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
string="Tracking ID"
string="HMAC secret"

<div class="mt16" invisible="not altcha_enabled">
<label
class="col-md-3 o_light_label"
string="Private Key"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
string="Private Key"
string="HMAC key secret"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants