AurityLab / vue-recaptcha-v3

A simple and easy to use reCAPTCHA (v3 only) library for Vue.
Apache License 2.0
236 stars 25 forks source link

Is "login" part of the syntax? #638

Closed woottonn closed 2 years ago

woottonn commented 2 years ago

Hi there

I've successfully implemented this on my page.. When the user clicks submit I want it to check the captcha...

I have this...

async recaptcha() {
            await this.$recaptchaLoaded()
            const token = await this.$recaptcha('login')
            // Do stuff with the received token.
},

Is the await this.$recaptcha('login') referring to some example? Or is that simple line of code checking that the user is human, and then I can go ahead and submit the form after // Do stuff with the received token? As I don't have any forms or functions on my page called "login"?

I hope that makes sense!

WipeAir commented 2 years ago

Hi! The first argument of the $recaptcha function is the reCAPTCHA action name. See here. You can use any name you'd like, 'login' is just an example. :) The token returned by the function can then be used on the backend for validation.