承接 networkteam/fusionform-altcha 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

networkteam/fusionform-altcha

Composer 安装命令:

composer require networkteam/fusionform-altcha

包简介

Use ALTCHA Next-Gen Captcha with Neos.Fusion.Form in Neos CMS

README 文档

README

MIT license Packagist

ALTCHA Next-Gen Captcha for Neos.Fusion.Form

Use ALTCHA Next-Gen Captcha with Fusion Form in Neos CMS.

Inspired by NeosRulez.Neos.Form.AltchaCaptcha

This package provides a Fusion Form field, which renders and the captcha. Your form will be protected when using the field in combination with the captcha validator.

Installation

Networkteam.FusionForm.Altcha is available via packagist. Run composer require networkteam/fusionform-altcha to install. Internally it requires the networkteam/flow-altcha package for Neos Flow framework, which brings basic functionality such as ALTCHA service and captcha validator.

Configuration:

The only thing you need to do to make the package work, is to set up an HMAC key for the challenge calculation. Do so by adding the key to setting Networkteam.Flow.Altcha.challenge.hmac. Ensure NOT to expose this key to the client.

Networkteam:
  Flow:
    Altcha:
      challenge:
        hmac: 'your-secret-hmac-key'

All configuration options can be found in Networkteam.Flow.Altcha package:

Packages/Application/Networkteam.Flow.Altcha/Configuration/Settings.yaml

Networkteam:
  Flow:
    Altcha:
      challenge:
        # Hashing algorithm to use (`SHA-1`, `SHA-256`, `SHA-512`, default:`SHA-256`)
        algorithm: SHA-256
        # Minimum number for the random number generator (default: 5,0000)
        minNumber: 5000
        # Maximum number for the random number generator (default: 1,000,000)
        maxNumber: 1000000
        # Expiration time for the challenge in seconds
        expires: 1200
        # Length of the random salt (default: 12 bytes).
        saltLength: 12
        # HMAC key for challenge calculation and solution verification. Ensure NOT to expose this number to the client.
        hmac:

Usage with Neos.Fusion.Form

To make use of the captcha you must extend an existing Neos.Fusion.Form form by adding the captcha field Networkteam.FusionForm.Altcha:Captcha to form content. Wrap it in Neos.Fusion.Form:FieldContainer to make use of error message rendering.

Then add the captcha field with validator to schema definition:

schema {
    captcha = ${Form.Schema.string().validator('Networkteam.Flow.Altcha:Captcha')}
}

Example of simple contact form

prototype(Vendor.Site:Content.SingleStepFormExample) < prototype(Neos.Fusion.Form:Runtime.RuntimeForm) {

    namespace = "single_step_form_example"

    process {

        content = afx`
            <Neos.Fusion.Form:FieldContainer field.name="firstName" label="First Name">
                <Neos.Fusion.Form:Input />
            </Neos.Fusion.Form:FieldContainer>
            <Neos.Fusion.Form:FieldContainer field.name="lastName" label="Last Name">
                <Neos.Fusion.Form:Input />
            </Neos.Fusion.Form:FieldContainer>
            <Neos.Fusion.Form:FieldContainer field.name="birthDate" label="BirthDate">
                <Neos.Fusion.Form:Date />
            </Neos.Fusion.Form:FieldContainer>
            <Neos.Fusion.Form:FieldContainer field.name="message" label="Message">
                <Neos.Fusion.Form:Textfield />
            </Neos.Fusion.Form:FieldContainer>
            
            <!-- wrap captcha field by FieldContainer to make use of error message rendering -->
            <Neos.Fusion.Form:FieldContainer field.name="captcha">
                <Networkteam.FusionForm.Altcha:Captcha />
            </Neos.Fusion.Form:FieldContainer>
        `

        schema {
            firstName = ${Form.Schema.string().isRequired()}
            lastName = ${Form.Schema.string().isRequired().validator('StringLength', {minimum: 6, maximum: 12})}
            birthDate =  ${Form.Schema.date().isRequired()}
            message = ${Form.Schema.string().isRequired()}
            
            // add captha field with validator
            captcha = ${Form.Schema.string().validator('Networkteam.Flow.Altcha:Captcha')}
        }
        
        action {
            // ...
        }
    }
}

Add ALTCHA JavaScript widget

The captcha field needs JavaScript for rendering the ALTCHA widget. You can use the fusion prototype Networkteam.FusionForm.Altcha:Script inside head.javascripts section of Neos.Neos:Page or CDN as described in ALTCHA documentation.

Add JavaScript to head of Neos.Neos:Page

prototype(Neos.Neos:Page) {
    head {
        javascripts {
            alcha = Networkteam.FusionForm.Altcha:Script
        }
    }
}

Alternatively, install the NPM package altcha and import it to your build process.

Usage with Sitegeist.PaperTiger

This package ships with a content element for Sitegeist.PaperTiger: Networkteam.FusionForm.Altcha:PaperTiger.Field.Captcha.

If you use Sitegeist.PaperTiger in your project, the content element is available within group form.special of Neos UI content dialog.

FAQ

How can I use different challenge configuration in my project

If you want to create different challenges for different forms in your project you can override the global challenge configuration via eel helper in Fusion. Additionally, you have to configure the captcha validator in your schema with the same options.

Override challenge via prototype nesting and configure schema captcha validator

prototype(Vendor.Site:Content.SingleStepFormExample) < prototype(Neos.Fusion.Form:Runtime.RuntimeForm) {

    prototype(Networkteam.FusionForm.Altcha:Captcha) {
        // use SHA-512 algorithm and different minNumber
        challenge = ${Networkteam.Altcha.Challenge.algorithm('SHA-512').minNumber(3500).create()}
    }

    namespace = "single_step_form_example"

    process {
        schema {
            // use SHA-512 algorithm and different minNumber
            captcha = ${Form.Schema.string().validator('Networkteam.Flow.Altcha:Captcha', { algorithm: 'SHA-512', minNumber: 3500 })}
        }
    }
}

networkteam/fusionform-altcha 适用场景与选型建议

networkteam/fusionform-altcha 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.09k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 04 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 networkteam/fusionform-altcha 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 networkteam/fusionform-altcha 我们能提供哪些服务?
定制开发 / 二次开发

基于 networkteam/fusionform-altcha 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 25
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-10