How to implement reCAPTCHA in an angular application.
reCAPTCHA (Completely automated public Turing test to tell computers and humans apart), better known as reCAPTCHA, is a test to ensure responses through a human versus a computer program.
Followings are the steps given below:-
1. The easiest way is to install through npm:
Command:- npm i ng-recaptcha --save
2.Add google Recaptcha library in index.html file in <head> tag.
3.Import Recaptcha Module.
Once you completely import captcha, add <re-captcha> tag in html file and add callback function for recaptcha functionality.
(ii). In app.component.html file add re-captcha tag in the form tag.
You will also need to invoke the "onCaptchaResponse($event)" method manually.when you hit on recaptcha checkbox a callback function is hit api for getting response, if you getting true response you will able to logIn successfully otherwise on getting false recaptcha will popup open again.
(iii). In app.component.ts file import reCAPTCHA component and function.
Loading the reCAPTCHA API by yourself.
For server sie reCAPTCHA API Integration.
Add a function in service file
(iii). In app.service.ts
The purpose of CAPTCHA is to distinguish between a machine and a human being. As a machine or robot can be used for filling forms with random data but an image or audio to be entered cannot be done by a robot or machine and hence a human being only can do it. The step that makes you prove that you are a human is primarily a CAPTCHA(Completely Automated Public Turing test to tell Computers and Humans Apart). Initially, a CAPTCHA formed of image or audio for verification. But there would a recent change in CAPTCHA verification vector which just requires a user to click on a checkbox to verify himself/herself as a human being.
Captcha's are must to protect your website from spam messages but sometimes they can shoo the actual users, Google’s new reCaptcha makes it’s much easier for humans to pass, at the same time producing it more difficult for bots. Also, the reCaptcha widget looks cool as compared to the older version, plus the integration is very very easy.