getgrav / grav-plugin-form

Grav Form Plugin
http://getgrav.org
MIT License
53 stars 79 forks source link

reCaptcha doesn't work with the attachment field #570

Open 01Kuzma opened 2 years ago

01Kuzma commented 2 years ago

Hi, tired of spam I've been trying to implement the Captcha v3 verification with the already working AJAX form. And I've observed that reCaptcha doesn't work with the attachment field. I've created a more simplified form as an example:

title: Contact
form:
    name: contact-form
    fields:
        name:
            label: Name
            placeholder: 'Enter your name'
            autocomplete: 'off'
            type: text
            validate:
                required: true
        email:
            label: Email
            placeholder: 'Enter your email address'
            type: email
            validate:
                required: true
        phoneNumber:
            label: 'Phone number'
            placeholder: 'Enter your phone number address'
            type: tel
            validate:
                required: false
        my-file:
            type: file
            multiple: true
            limit: 5
            filesize: 6
            destination: user/data/files
            accept:
                - application/pdf
                - application/x-pdf
                - 'image/*'
                - '.doc, .docx, .pdf, .xls, .xlsx'
                - 'application/msword,'
                - application/vnd.openxmlformats-officedocument.wordprocessingml.document
                - application/vnd.ms-excel
                - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
        g-recaptcha-response:
            type: captcha
            label: Captcha
            recaptcha_not_validated: 'Captcha is not valid'
    buttons:
        submit:
            type: submit
            value: Submit
            classes: primary-button
    process:
        captcha: true
        email:
            from: '{{ config.plugins.email.from }}'
            to: '{{ config.plugins.email.to }}'
            subject: 'some message'
            body: '{% include ''forms/data.html.twig'' %}'
            attachments:
                - my-file

reCaptcha v3 keys are set in form settings. Grav v1.7.33 Form v6.0.3

Once the g-recaptcha-response: field is added these errors arise: image