diff --git a/src/app/shared/contact/contact.component.ts b/src/app/shared/contact/contact.component.ts index 58716ebe2e5eb075ba29ffd0ab7280f8b10cde22..2cbe500a10d5dc57ce3db81fbaf8b35c7f00b173 100644 --- a/src/app/shared/contact/contact.component.ts +++ b/src/app/shared/contact/contact.component.ts @@ -125,6 +125,7 @@ export class ContactComponent implements OnInit { private sendMail(data: any): Observable<void> { // submit captcha request return this.recaptchaV3Service.execute('contactForm').pipe( + catchError(_ => of('')), // in case of captcha error return empty token map((token) => { const result = {token, mail: new Mail()} // create mail object result.mail.otherAttributes = data; // set properties and mail attributes diff --git a/src/app/welcome/passwordreset/password-reset.component.ts b/src/app/welcome/passwordreset/password-reset.component.ts index 446faf46c365c937162f4a514f515bd703429346..3b65c5af3c24842613f0d36778267f4f867282c1 100644 --- a/src/app/welcome/passwordreset/password-reset.component.ts +++ b/src/app/welcome/passwordreset/password-reset.component.ts @@ -7,6 +7,8 @@ import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {PasswordValidator} from '../../shared'; import {PasswordStrengthMeterComponent} from 'angular-password-strength-meter'; import {ReCaptchaV3Service} from 'ng-recaptcha'; +import {catchError} from 'rxjs/operators'; +import {of} from 'rxjs'; @Component({ selector: 'app-passwordreset', @@ -53,7 +55,9 @@ export class PasswordResetComponent implements OnInit { public resetPassword() { if (this.form.valid) { - this.recaptchaV3Service.execute('password_reset').subscribe((captchaToken) => { + this.recaptchaV3Service.execute('password_reset').pipe( + catchError(_ => of('')), // in case of captcha error return empty token + ).subscribe((captchaToken) => { this.passwordReset.password = this.form.controls['newPassword'].value; this.passwordReset.token = this.token; this.userService.resetPassword(this.passwordReset, captchaToken).subscribe( diff --git a/src/app/welcome/registration/registration.component.ts b/src/app/welcome/registration/registration.component.ts index 18b8ce0aeaf5449ec8856f197384a9a839992753..a9ade492d2ba7fa05e5e370639ce8e90fa55db1c 100644 --- a/src/app/welcome/registration/registration.component.ts +++ b/src/app/welcome/registration/registration.component.ts @@ -5,14 +5,14 @@ import {AppConfigService} from '../../service/appconfig.service'; import {PasswordValidator} from '../../shared/common/password/password.component'; import {Component, OnInit, ViewChild} from '@angular/core'; import {FormGroup, FormBuilder, Validators} from '@angular/forms'; -import {Observable} from 'rxjs'; +import {Observable, of} from 'rxjs'; import {ModalInfoTermsComponent} from '../../shared/modal/modal-info-terms/modal-info-terms.component'; import {ModalInfoPolicyComponent} from '../../shared/modal/modal-info-policy/modal-info-policy.component'; import {ModalComponent} from '../../shared/modal'; import {PasswordStrengthMeterComponent} from 'angular-password-strength-meter'; import {TranslateService} from '@ngx-translate/core'; -import {map} from 'rxjs/operators'; +import {catchError, map} from 'rxjs/operators'; import {ReCaptchaV3Service} from 'ng-recaptcha'; @Component({ @@ -76,7 +76,9 @@ export class RegistrationComponent implements OnInit { } public onSubmit(): void { - this.recaptchaV3Service.execute('registration').subscribe((captchaToken) => { + this.recaptchaV3Service.execute('registration').pipe( + catchError(_ => of('')), // in case of captcha error return empty token + ).subscribe((captchaToken) => { if (!this.registrationForm.controls['termsOfUseAccepted'].value || !this.registrationForm.controls['privacyPolicyAccepted'].value) { this.sending = false;