Skip to content

Commit

Permalink
Task #58593: reverting captcha v3 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
christyfernandes committed Jun 8, 2022
1 parent 059bf7c commit 739486e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
32 changes: 15 additions & 17 deletions src/app/routes/public/public-signup/public-signup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -62,15 +61,14 @@ export class PublicSignupComponent implements OnInit, OnDestroy {
confirm = false

private subscriptionContact: Subscription | null = null
private recaptchaSubscription!: Subscription
// private recaptchaSubscription!: Subscription

constructor(
private signupSvc: SignupService,
private loggerSvc: LoggerService,
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)]),
Expand Down Expand Up @@ -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) => {
Expand All @@ -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 || '',
Expand Down
7 changes: 0 additions & 7 deletions src/app/routes/public/public-signup/public-signup.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit 739486e

Please sign in to comment.