-
Notifications
You must be signed in to change notification settings - Fork 3
Service:reCAPTCHA
Get your site key from the reCAPTCHA developer portal.
Then update the EmberJS environment configuration file in config/environment
with properties for configuring reCAPTCHA for your application.
ENV.GoogleENV = {
reCAPTCHA: {
siteKey: // site key from reCAPTCHA developer portal
}
}
Last, add the reCAPTCHA component to the template for the target route.
{{g-recaptcha-v2 onResponse=(mut response)}}
In the example above, the reCAPTCHA response string will be stored in a
variable named response
. The response string can then be sent to the
server with the rest of form data to verify the person is not a robot.
Invisible reCAPTCHA is added to your page in a similar manner as v2.
{{g-recaptcha-invisible onResponse=(mut response) reset=reset}}
For invisible reCAPTCHA, you must configure the reset
attribute. This
attribute is set by the parent component (or controller) when the invisible
reCAPTCHA must be reset. For example, the user clicks outside the test window,
which causes it to disappear, and then types on the corresponding HTML form.
In this scenario, the reCAPTCHA widget will not generate a response to verify
the user is not a robot. Instead, the user must reset the component, and try
again.
If you place the invisible reCAPTCHA inside an HTML form, and the HTML form has a
submit
button, then the button will be automatically disabled until a response is generated.
There is a change that is the user waits to long to verify the response, then
the reCAPTCHA will expire. To handle this event, assing an action to the onExpired
property.
{{g-recaptcha-v2 onResponse=(mut response) onExpired=(action "expired")}}
The current add-on supports multiple reCAPTCHA widgets on the same route.
See the official reCAPTHCA documentation for more information.