aryehraber / statamic-captcha

Statamic Addon that protects your Statamic forms using a Captcha service.
MIT License
11 stars 8 forks source link

Hcaptcha is not checking the form #12

Closed dominikfladung closed 3 years ago

dominikfladung commented 3 years ago

Hello,

I am not sure, if i miss something. If I submit the form the success message appears. If I fill the captcha it counts up in the hcaptcha Dashboard.

captcha.php

<?php
return [
    'service' => 'Hcaptcha', // options: Recaptcha / Hcaptcha
    'sitekey' => env('CAPTCHA_SITEKEY', ''),
    'secret' => env('CAPTCHA_SECRET', ''),
    'collections' => [],
    'forms' => ['kontakt'],
    'error_message' => 'Captcha failed.',
    'disclaimer' => '',
    'invisible' => false,
    'hide_badge' => false,
    'enable_api_routes' => false,
];

kontakt.antlers.html

{{ form:kontakt }}
{{ captcha:head }}
{{ if success }}
    <div class="bg-green-300 text-white p-2">
        {{ success }}
    </div>
{{ else }}
    {{ if errors }}
        <div class="bg-red-300 text-white p-2">
            {{ errors }}
            {{ value }}<br>
            {{ /errors }}
        </div>
    {{ /if }}

    {{ fields }}
    <div class="p-2">
        <label class="block font-medium text-gray-700">{{ display }}</label>
        <div class="p-1">{{ field }}</div>
        {{ if error }}
            <p class="text-gray-500">{{ error }}</p>
        {{ /if }}
    </div>
    {{ /fields }}

    <div class="p-2">
        {{ captcha }}

        {{ if error:captcha }}
            <p>{{ error:captcha }}</p>
        {{ /if }}

    </div>

    <div class="p-2">
        <button class="primary" type="submit">Absenden</button>
    </div>
{{ /if }}

{{ /form:kontakt }}

composer.json

      "aryehraber/statamic-captcha": "^1.3",

composer.lock

        "name": "aryehraber/statamic-captcha",
            "version": "v1.3.0",
            "source": {
                "type": "git",
                "url": "https://github.com/aryehraber/statamic-captcha.git",
                "reference": "5a87dd626773125edd624daded40a74c33663151"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/aryehraber/statamic-captcha/zipball/5a87dd626773125edd624daded40a74c33663151",
                "reference": "5a87dd626773125edd624daded40a74c33663151",
                "shasum": ""
            },
            "require": {
                "statamic/cms": "^3.0"
            },
            "type": "statamic-addon",
            "extra": {
                "statamic": {
                    "name": "Captcha",
                    "slug": "captcha",
                    "description": "Protect your Statamic forms using a Captcha service",
                    "version": "1.3.0"
                },
                "laravel": {
                    "providers": [
                        "AryehRaber\\Captcha\\CaptchaServiceProvider"
                    ]
                }
            },
            "autoload": {
                "psr-4": {
                    "AryehRaber\\Captcha\\": "src"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Aryeh Raber",
                    "email": "aryeh.raber@gmail.com",
                    "homepage": "https://aryeh.dev",
                    "role": "Developer"
                }
            ],
            "description": "Protect your Statamic forms using a Captcha service",
            "homepage": "https://github.com/aryehraber/statamic-captcha",
            "keywords": [
                "Forms",
                "captcha",
                "hcaptcha",
                "recaptcha",
                "statamic"
            ],
            "support": {
                "issues": "https://github.com/aryehraber/statamic-captcha/issues",
                "source": "https://github.com/aryehraber/statamic-captcha/tree/v1.3.0"
            },
            "time": "2021-01-27T08:52:16+00:00"
        },
dominikfladung commented 3 years ago

I did not upload the config file

michaelmannucci commented 2 years ago

I'm having this issue and not sure what you mean by "I did not upload the config file". I can submit my form without completing the captcha.

aryehraber commented 2 years ago

Hey @michaelmannucci, for Captcha to work you need to configure a captcha.php config file where you setup which forms you want Captcha to handle -- without this file, Captcha does nothing. Try and follow the Installation instructions carefully, including publishing the config file, and report back if you're still having issues.