Autoform + ayue:recaptcha not working right


#1

So my approach to this…
On my contact.js:

AutoForm.hooks({
    App_kontakt: {
		onSubmit: function (
		formData, recaptchaResponse) {		
			var formData = {
           
        };


        var recaptchaResponse = grecaptcha.getResponse();

        Meteor.call('formSubmissionMethod', formData, recaptchaResponse, function(error, result) {
            if (error) {
                console.log('There was an error: ' + error.reason);
            } else {
                console.log('Success!');
            }
        });
    },

So I did a hook and an onsubmit event.
On my contact.html:

{{> reCAPTCHA}} in the form.

On my main.js:

Meteor.methods({
formSubmissionMethod: function(formData, recaptchaResponse) {

        var verifyCaptchaResponse = reCAPTCHA.verifyCaptcha(recaptchaResponse, this.connection.clientAddress);

        if (!verifyCaptchaResponse.success) {
            console.log('reCAPTCHA check failed!', verifyCaptchaResponse);
            throw new Meteor.Error(422, 'reCAPTCHA Failed: ' + verifyCaptchaResponse.error);
        } else
            console.log('reCAPTCHA verification passed!');

        //do stuff with your formData

        return true;
    },
  sendEmail: function(doc) {

    // Build the e-mail text
    var text = "Name: " + doc.name + "\n\n"
            + "E-Mail: " + doc.email + "\n\n\n\n"
			+ "Telefonnummer: " + doc.phone + "\n\n"
            + doc.message;

    this.unblock();

    // Send the e-mail
    //Email.send({
      //  to: "***",
       // from: doc.email,
      //  subject: "Neue Nachricht von: " + doc.name,
     //   text: text
  //  });
  //
  console.log('SENT!!!');
  }
});

So the problem is that I can solve the reCaptcha but even if I dont the form will send. Before I changed the submit to a hook I did it as it says in this documentation:

The form still sends even if I don’t solve the recaptcha but atleast it shows me in the console “reCAPTCHA verification passed!” or “'reCAPTCHA Failed:”

I just can’t find the problem. Did I forget something or is the package “ayue:recaptcha” not working with the current Meteor version.

Hope you can understand what I am talking about, if not just ask me. I am also on Discord or Teamspeak if you need further explanation to this problem. My native language is german btw.


#2

Hey did you find a solution for this ?

Im facing the same issue with this lib. No idea what m i missing in the implementation.

Thanks in advance