MOBILE-3320 signup: Expire recaptcha if error returned
parent
c15d5de95d
commit
ae7b380a72
|
@ -7,7 +7,7 @@
|
||||||
<ion-item *ngIf="model[modelValueName]">
|
<ion-item *ngIf="model[modelValueName]">
|
||||||
<ion-label color="success">{{ 'core.answered' | translate }}</ion-label>
|
<ion-label color="success">{{ 'core.answered' | translate }}</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item *ngIf="expired">
|
<ion-item *ngIf="expired" class="ion-text-wrap">
|
||||||
<ion-label color="danger">{{ 'core.login.recaptchaexpired' | translate }}</ion-label>
|
<ion-label color="danger">{{ 'core.login.recaptchaexpired' | translate }}</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -87,8 +87,7 @@ export class CoreRecaptchaComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.data.action == 'expired') {
|
if (event.data.action == 'expired') {
|
||||||
this.expired = true;
|
this.expireRecaptchaAnswer();
|
||||||
this.model![this.modelValueName] = '';
|
|
||||||
} else if (event.data.action == 'callback') {
|
} else if (event.data.action == 'callback') {
|
||||||
this.expired = false;
|
this.expired = false;
|
||||||
this.model![this.modelValueName] = event.data.value;
|
this.model![this.modelValueName] = event.data.value;
|
||||||
|
@ -101,4 +100,12 @@ export class CoreRecaptchaComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expire the recaptcha answer.
|
||||||
|
*/
|
||||||
|
expireRecaptchaAnswer(): void {
|
||||||
|
this.expired = true;
|
||||||
|
this.model![this.modelValueName] = '';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import {
|
||||||
} from '@features/login/services/login-helper';
|
} from '@features/login/services/login-helper';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
import { CoreForms } from '@singletons/form';
|
import { CoreForms } from '@singletons/form';
|
||||||
|
import { CoreRecaptchaComponent } from '@components/recaptcha/recaptcha';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page to signup using email.
|
* Page to signup using email.
|
||||||
|
@ -45,6 +46,7 @@ import { CoreForms } from '@singletons/form';
|
||||||
export class CoreLoginEmailSignupPage implements OnInit {
|
export class CoreLoginEmailSignupPage implements OnInit {
|
||||||
|
|
||||||
@ViewChild(IonContent) content?: IonContent;
|
@ViewChild(IonContent) content?: IonContent;
|
||||||
|
@ViewChild(CoreRecaptchaComponent) recaptchaComponent?: CoreRecaptchaComponent;
|
||||||
@ViewChild('ageForm') ageFormElement?: ElementRef;
|
@ViewChild('ageForm') ageFormElement?: ElementRef;
|
||||||
@ViewChild('signupFormEl') signupFormElement?: ElementRef;
|
@ViewChild('signupFormEl') signupFormElement?: ElementRef;
|
||||||
|
|
||||||
|
@ -341,9 +343,12 @@ export class CoreLoginEmailSignupPage implements OnInit {
|
||||||
CoreDomUtils.showAlert(Translate.instant('core.success'), message);
|
CoreDomUtils.showAlert(Translate.instant('core.success'), message);
|
||||||
CoreNavigator.back();
|
CoreNavigator.back();
|
||||||
} else {
|
} else {
|
||||||
if (result.warnings && result.warnings.length) {
|
this.recaptchaComponent?.expireRecaptchaAnswer();
|
||||||
let error = result.warnings[0].message;
|
|
||||||
if (error == 'incorrect-captcha-sol') {
|
const warning = result.warnings?.[0];
|
||||||
|
if (warning) {
|
||||||
|
let error = warning.message;
|
||||||
|
if (error == 'incorrect-captcha-sol' || (!error && warning.item == 'recaptcharesponse')) {
|
||||||
error = Translate.instant('core.login.recaptchaincorrect');
|
error = Translate.instant('core.login.recaptchaincorrect');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue