Skip to content
Snippets Groups Projects
Commit efc72dd3 authored by Wojciech Taisner's avatar Wojciech Taisner Committed by Lukasz Lopatowski
Browse files

Pull request #24: NMAAS-1038 Disable recaptcha checks if keys are not provided

Merge in NMAAS/nmaas-portal from NMAAS-1038-disable-recaptcha-checks-if-keys-are-not-provided to develop

* commit 'c499493b':
  NMAAS-1038 in case of captcha service errors send empty token
parents 952d95df c499493b
Branches
Tags
No related merge requests found
......@@ -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
......
......@@ -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(
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment