How to implement Captcha code in Angular8

Posted by Manideepgoud under Angular on 8/6/2020 | Points: 10 | Views : 1216 | Status : [Member] | Replies : 2
Hi Sheo sir,

Need some help in implementing captcha code(generating captcha code with refresh button) in Angular8.

Can some one help me in this please.




Responses

Posted by: Ishan7 on: 11/23/2020 [Member] Starter | Points: 25

Up
1
Down
Step 1: Install Angular Captcha Module
npm install angular-captcha --save

app.module.ts
// import the Angular Captcha Module 
import { BotDetectCaptchaModule } from 'angular-captcha';

@NgModule({
imports: [
...
BotDetectCaptchaModule
],
...
})



Step 2:Set the captchaEndpoint in Your App's Frontend
import { CaptchaComponent } from 'angular-captcha'; 

export class YourFormWithCaptchaComponent {

ngOnInit(): void {
this.captchaComponent.captchaEndpoint =
'https://your-app-backend-hostname.your-domain.com/simple-captcha-endpoint';
}


Step 3:Displaying the Captcha Challenge in Your Form
<botdetect-captcha captchaStyleName="yourFirstCaptchaStyle"></botdetect-captcha>  
<input id="userCaptchaInput"
name="userCaptchaInput"
ngModel
#userCaptchaInput="ngModel"
type="text" >


Step 4:Validate C#
SimpleCaptcha yourFirstCaptcha = new SimpleCaptcha();
bool isHuman = yourFirstCaptcha.Validate(userEnteredCaptchaCode, captchaId);


Manideepgoud, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Aptrontraining on: 3/1/2021 [Member] Starter | Points: 25

Up
0
Down
To start using reCAPTCHA, you need to sign up for an API key pair for your site. The key pair consists of a site key and secret key. The site key is used to invoke the reCAPTCHA service on your site or mobile application. The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user’s response. The secret key needs to be kept safe for security purposes.
https://w3path.com/how-to-integrate-recaptcha-in-angular-8/
http://aptronnoida.in/best-angularjs-training-in-noida.html

Manideepgoud, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response