xsanz/magento2-module-admin-color-captcha
Composer 安装命令:
composer require xsanz/magento2-module-admin-color-captcha
包简介
Magento 2 admin image CAPTCHA with optional per-character colors and grayscale noise (XavierSanz_ColorCaptcha).
README 文档
README
Admin image CAPTCHA enhancement for Magento 2: optional per-character colors and grayscale noise for better readability on the backend login (and other admin forms that use the default image CAPTCHA). Storefront CAPTCHA is unchanged.
- License: MIT — see LICENSE.txt.
Requirements
- Magento 2.4.x (Open Source or Adobe Commerce) with
Magento_Captchaenabled - PHP 8.x (match your Magento installation)
- GD extension with FreeType (
imagefttext) support (same as core image CAPTCHA)
Installation
Option A — app/code (typical)
-
Ensure the module lives at:
app/code/XavierSanz/ColorCaptcha/ -
Enable the module and update the database:
bin/magento module:enable XavierSanz_ColorCaptcha bin/magento setup:upgrade
-
Recompile DI (production mode) and flush caches:
bin/magento setup:di:compile bin/magento cache:flush
Option B — Composer (path repository)
The package name is xsanz/magento2-module-admin-color-captcha (see composer.json). In the Magento project composer.json, add a path repository pointing at this directory, then:
composer require xsanz/magento2-module-admin-color-captcha:^1.0 bin/magento module:enable XavierSanz_ColorCaptcha bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:flush
Adjust the version constraint if you tag releases (e.g. ^1.0).
How to use
1. Turn on admin CAPTCHA (core)
Per-character colors only apply when Admin CAPTCHA is enabled.
- In the Admin, go to Stores → Configuration.
- Open Advanced → Admin → CAPTCHA.
- Set Enable CAPTCHA in Admin to Yes and configure forms, mode, and attempts as needed.
2. Enable per-character color mode (this module)
In the same section (Advanced → Admin → CAPTCHA), below the standard fields:
- Set Enable Per-Character Color CAPTCHA to Yes.
- Optionally adjust Text luminance and Noise luminance fields (all are 0–255, BT.601 luminance).
Defaults (from etc/config.xml, restorable via Use Default in the UI):
| Setting | Default | Purpose |
|---|---|---|
| Enable Per-Character Color CAPTCHA | No (opt-in) | Off = stock Laminas image; On = colored glyphs + gray noise |
| Text luminance min | 0 |
Darkest allowed brightness for glyphs |
| Text luminance max | 105 |
Lightest allowed for glyphs (keep low for contrast on white) |
| Noise luminance min | 140 |
Darkest gray for dots/lines |
| Noise luminance max | 160 |
Lightest gray for noise |
Keep text luminance max clearly below noise luminance min so letters stay darker than the noise.
3. When you will see it
Admin CAPTCHA appears according to your Displaying Mode (e.g. after failed login attempts). Refresh the CAPTCHA image with the reload control next to the image if needed.
Behavior notes
- Admin only: The module replaces
Magento\Captcha\Model\DefaultModelonly in the adminhtml area. Customer-facing CAPTCHA is not affected. - With the feature off: Behavior matches core (single-color Laminas image pipeline).
- With the feature on: Each character is drawn in a random color within the text luminance bounds; noise is grayscale only; distortion uses an RGB-preserving resample so colors remain visible after the wave transform.
Configuration scope
The CAPTCHA group is available per website scope in Configuration. If you use multiple websites, set values under the scope where you manage admin settings (often Default Config).
Uninstall
bin/magento module:disable XavierSanz_ColorCaptcha bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:flush
Remove the module files if you no longer need them. Config keys under admin/captcha/* for this module may remain in the core_config_data table until cleaned up manually if required.
Support
Issues and improvements: maintain in your project or VCS as appropriate for XavierSanz_ColorCaptcha.
xsanz/magento2-module-admin-color-captcha 适用场景与选型建议
xsanz/magento2-module-admin-color-captcha 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 05 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 xsanz/magento2-module-admin-color-captcha 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 xsanz/magento2-module-admin-color-captcha 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 47
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-08