leitsch/kirby-uniform-hcaptcha 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

leitsch/kirby-uniform-hcaptcha

Composer 安装命令:

composer require leitsch/kirby-uniform-hcaptcha

包简介

Kirby 3 hCaptcha guard for the Uniform plugin

README 文档

README

A Kirby 3 plugin implementing a hCaptcha guard for the Uniform plugin.

Installation

Composer

Add the plugin to your project:

composer require leitsch/kirby-uniform-hcaptcha

Configuration

Set the configuration in your config.php file:

return [
  'leitsch.uniform-hcaptcha.siteKey' => 'my-site-key',
  'leitsch.uniform-hcaptcha.secretKey' => 'my-secret-key',
];

Usage

Template

You can use the provided helper function to embed the hCaptcha into your template:

<?= hcaptchaField() ?>

In order for hCaptcha to work, you need to provide the hCaptcha JavaScript file.

Use the helper function hcaptchaScript() in your template.

Example

<form action="<?= $page->url() ?>" method="post">
    <label for="name" class="required">Name</label>
    <input<?php if ($form->error('name')): ?> class="erroneous"<?php endif; ?> name="name" type="text" value="<?= $form->old('name') ?>">

    <!-- ... -->

    <?= csrf_field() ?>
    <?= hcaptchaField() ?>
    <input type="submit" value="Submit">
</form>
<?= hcaptchaScript() ?>

Controller

In your controller you can use the magic method hcaptchaGuard() to enable the hCaptcha guard:

$form = new Form(/* ... */);

if ($kirby->request()->is('POST'))
{
    $form->hcaptchaGuard()
         ->emailAction(/* ... */);
}

Credits

统计信息

  • 总下载量: 38
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固