From 739486eaacc1729c322ccde2093310bfc450536e Mon Sep 17 00:00:00 2001 From: "christopher.fernandes" Date: Wed, 8 Jun 2022 17:06:50 +0530 Subject: [PATCH] Task #58593: reverting captcha v3 changes --- package.json | 1 - .../public-signup/public-signup.component.ts | 32 +++++++++---------- .../public-signup/public-signup.module.ts | 7 ---- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index a73207b7d..5b41d2a6c 100755 --- a/package.json +++ b/package.json @@ -71,7 +71,6 @@ "mustache": "^3.0.2", "mux.js": "^5.11.0", "ng-circle-progress": "1.5.1", - "ng-recaptcha": "8.0.1", "ng2-ace-editor": "^0.3.9", "ng2-charts": "^2.4.3", "ng2-ckeditor": "1.2.6", diff --git a/src/app/routes/public/public-signup/public-signup.component.ts b/src/app/routes/public/public-signup/public-signup.component.ts index 921d9ce7f..d31178d6a 100644 --- a/src/app/routes/public/public-signup/public-signup.component.ts +++ b/src/app/routes/public/public-signup/public-signup.component.ts @@ -6,7 +6,6 @@ import { LoggerService, ConfigurationsService, NsInstanceConfig } from '@sunbird import { debounceTime, distinctUntilChanged, startWith, map } from 'rxjs/operators' import { environment } from 'src/environments/environment' import { MatSnackBar, MatDialog } from '@angular/material' -import { ReCaptchaV3Service } from 'ng-recaptcha' import { SignupSuccessDialogueComponent } from './signup-success-dialogue/signup-success-dialogue/signup-success-dialogue.component' export function forbiddenNamesValidator(optionsArray: any): ValidatorFn { @@ -62,7 +61,7 @@ export class PublicSignupComponent implements OnInit, OnDestroy { confirm = false private subscriptionContact: Subscription | null = null - private recaptchaSubscription!: Subscription + // private recaptchaSubscription!: Subscription constructor( private signupSvc: SignupService, @@ -70,7 +69,6 @@ export class PublicSignupComponent implements OnInit, OnDestroy { private configSvc: ConfigurationsService, private snackBar: MatSnackBar, private dialog: MatDialog, - private recaptchaV3Service: ReCaptchaV3Service ) { this.registrationForm = new FormGroup({ firstname: new FormControl('', [Validators.required, Validators.pattern(this.namePatern)]), @@ -172,9 +170,9 @@ export class PublicSignupComponent implements OnInit, OnDestroy { if (this.subscriptionContact) { this.subscriptionContact.unsubscribe() } - if (this.recaptchaSubscription) { - this.recaptchaSubscription.unsubscribe() - } + // if (this.recaptchaSubscription) { + // this.recaptchaSubscription.unsubscribe() + // } } displayFn = (value: any) => { @@ -187,17 +185,17 @@ export class PublicSignupComponent implements OnInit, OnDestroy { signup() { - this.recaptchaSubscription = this.recaptchaV3Service.execute('importantAction') - .subscribe( - _token => { - // tslint:disable-next-line: no-console - console.log('captcha validation success') - }, - error => { - // tslint:disable-next-line: no-console - console.error('captcha validation error', error) - } - ) + // this.recaptchaSubscription = this.recaptchaV3Service.execute('importantAction') + // .subscribe( + // _token => { + // // tslint:disable-next-line: no-console + // console.log('captcha validation success') + // }, + // error => { + // // tslint:disable-next-line: no-console + // console.error('captcha validation error', error) + // } + // ) const req = { firstName: this.registrationForm.value.firstname || '', diff --git a/src/app/routes/public/public-signup/public-signup.module.ts b/src/app/routes/public/public-signup/public-signup.module.ts index db7d76ed5..434eec299 100644 --- a/src/app/routes/public/public-signup/public-signup.module.ts +++ b/src/app/routes/public/public-signup/public-signup.module.ts @@ -29,9 +29,7 @@ import { PublicSignupComponent } from './public-signup.component' import { FormsModule, ReactiveFormsModule } from '@angular/forms' import { RouterModule } from '@angular/router' import { SignupService } from './signup.service' -import { RECAPTCHA_V3_SITE_KEY, RecaptchaV3Module } from 'ng-recaptcha' import { SignupSuccessDialogueComponent } from './signup-success-dialogue/signup-success-dialogue/signup-success-dialogue.component' -import { environment } from 'src/environments/environment' @NgModule({ declarations: [PublicSignupComponent, SignupSuccessDialogueComponent], @@ -63,15 +61,10 @@ import { environment } from 'src/environments/environment' MatButtonToggleModule, MatTabsModule, MatAutocompleteModule, - RecaptchaV3Module, ], exports: [PublicSignupComponent], providers: [ SignupService, - { - provide: RECAPTCHA_V3_SITE_KEY, - useValue: environment.recaptcha.siteKey, - }, ], entryComponents: [SignupSuccessDialogueComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA],