Problem/Motivation

Currently the shipped minfied js in "assets/vendor/altcha" is still using Altcha v2, but Altcha v3 is the latest version.

See https://altcha.org/docs/v2/migration/widget-v2 on how to migrate from v3 to v2.

Thanks for the wonderful module!

Steps to reproduce

Proposed resolution

Additionally I'd vote to add a new 3.x branch (skipping 2.x) for altcha v3 to sync the Drupal module version with the library like other modules do. That's quite intuitive.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork altcha-3589732

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

grevil created an issue. See original summary.

anybody’s picture

Issue summary: View changes
anybody’s picture

Issue summary: View changes

harjyottkaurr made their first commit to this issue’s fork.

harjyottkaurr’s picture

Assigned: Unassigned » harjyottkaurr

harjyottkaurr’s picture

Status: Active » Needs review

This MR adds support for Altcha v3.

anybody’s picture

Status: Needs review » Needs work

The settings changes in the .module file will need an update hook or logics to be compatible with both versions. What's the maintainers branch plan?

akshay kashyap’s picture

I ran this MR locally and checked it against the Altcha v3 migration guide.

The widget uses the new v3 attributes now. For example, “challengeurl” is gone—now it’s just “challenge.” The old floating_mode setting gets mapped to the new display values (floating, floating-top, and floating-bottom) before rendering, so that part lines up with v3’s requirements.

I also followed up on the concern in #8 about an update hook. At first, I thought we might need one too. But after testing the upgrade path, I’m honestly not seeing the need. I tried upgrading with an existing config (floating_enabled, floating_mode, floating_offset), applied the MR, cleared caches, and made sure the widget still worked. The config keys themselves haven’t changed—it’s just the way they’re translated for the Altcha v3 widget at runtime that’s different. So, I don’t see any configuration that actually needs migrating.

The only scenario I can think of where an update hook would matter is if the module added new config keys or changed the config schema (like replacing floating_mode with a new display_mode setting). This MR doesn’t do that.

The last thing I’d recommend before making this RTBC is to check all remaining widget attributes against the Altcha v3 migration guide. Just make sure we aren’t missing any v2-specific attributes that need updating. Other than that, the runtime mapping looks solid. I didn’t find any config that needs migration.

akshay kashyap’s picture

Status: Needs work » Needs review
robindh’s picture

Assigned: harjyottkaurr » robindh
Status: Needs review » Needs work

Thanks for the initial work on this! I've synced with the other maintainers about the widget v2 > v3 upgrade path.
Our current plan is to leave the 1.x branch as-is, and create a new 2.x branch which will contain ALTCHA v3 widget support.

Main reason for a new major version release is the breaking change mentioned in the ALTCHA docs:

CSS structure and custom properties have been refactored. If you applied custom styles or variables, update them accordingly.

This might cause some regression for sites that have overridden widget styling.

We're not planning on skipping 2.x and creating a 3.x branch, mostly because we're using 2 different ALTCHA libraries that don't use synced versioning anyway:
- ALTCHA PHP library (will be v2)
- ALTCHA JS library (will be v3)

In the following days, I'll review the merge request and will probably add more support for some of the new features of the v3 widget

robindh’s picture

Assigned: robindh » jeremy.declerck
Status: Needs work » Needs review

Changes to the merge request since my last comment:
- Added requirement for the ALTCHA PHP v2 library
- Switched to the newer ALTCHA v2 algorithm as recommended by the docs
- Added support for widget themes
- Added support for additional widget modes (bar, overlay, ..)
- Added support for additional checkbox types (native, toggle)
- Added i18n compatibility based on the current 1.x branch
- Provided a migration path from v1 to v2

Also created a 2.x branch because of the breaking change

arno_vgh’s picture

I've reviewed the changes and noticed a few small issues:

  1. The fallback to the self-hosted widget is not working as expected.
    • Uses the old challengeUrl property instead of challenge.
    • It seems a bit buggy in auto-verification mode: after verification, the form is not submitted automatically.
  2. The 'Invisible' display mode requires the auto-verification to be enabled in order to work.
  3. The 'Bar' display mode could support the additional barPlacement configuration. From the docs: "barPlacement: Vertical position of the widget when display is set to bar ('bottom' or 'top’)".
  4. Nice to have: a simple custom example theme to show how to create or modify an ALTCHA widget theme.
arno_vgh’s picture

Assigned: jeremy.declerck » Unassigned
Status: Needs review » Needs work
robindh’s picture

Status: Needs work » Needs review

Thanks, I've processed the feedback:

  1. Fixed the fallback challenge attribute
  2. Added support for auto-verification when the fallback is triggered. Also created #3611105 to make sure this gets backported to 1.x
  3. When using invisible display mode; "on form submit" auto-verification will always be used. Also documented this behavior in the field description
  4. Added support for the barPlacement widget configuration option

For the example custom theme implementation, we can create a documentation page after the first 2.x release

robindh’s picture

Status: Needs review » Fixed

Thanks for the efforts on this issue! Merged into 2.x - will create a first dev release now.
After the upgrade path has been documented, I'll create the first 2.x beta / RC.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.