MOBILE-4362 signup: Display required error in recaptcha
parent
935da86caa
commit
8cda49f720
|
@ -7,7 +7,10 @@
|
||||||
<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" class="ion-text-wrap">
|
<ion-item *ngIf="expired" class="ion-text-wrap core-input-error">
|
||||||
<ion-label color="danger">{{ 'core.login.recaptchaexpired' | translate }}</ion-label>
|
<ion-label color="danger">{{ 'core.login.recaptchaexpired' | translate }}</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
<ion-item *ngIf="showRequiredError && !model[modelValueName] && !expired" class="ion-text-wrap core-input-error">
|
||||||
|
<ion-label color="danger">{{ 'core.required' | translate }}</ion-label>
|
||||||
|
</ion-item>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -32,6 +32,7 @@ export class CoreRecaptchaComponent implements OnInit {
|
||||||
@Input() publicKey?: string; // The site public key.
|
@Input() publicKey?: string; // The site public key.
|
||||||
@Input() modelValueName = 'recaptcharesponse'; // Name of the model property where to store the response.
|
@Input() modelValueName = 'recaptcharesponse'; // Name of the model property where to store the response.
|
||||||
@Input() siteUrl = ''; // The site URL. If not defined, current site.
|
@Input() siteUrl = ''; // The site URL. If not defined, current site.
|
||||||
|
@Input() showRequiredError = false; // Whether to display the required error if recaptcha hasn't been answered.
|
||||||
|
|
||||||
expired = false;
|
expired = false;
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,8 @@
|
||||||
<h2><span [core-mark-required]="true">{{ 'core.login.security_question' | translate }}</span></h2>
|
<h2><span [core-mark-required]="true">{{ 'core.login.security_question' | translate }}</span></h2>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item-divider>
|
</ion-item-divider>
|
||||||
<core-recaptcha [publicKey]="settings.recaptchapublickey" [model]="captcha" [siteUrl]="siteUrl"></core-recaptcha>
|
<core-recaptcha [publicKey]="settings.recaptchapublickey" [model]="captcha" [siteUrl]="siteUrl"
|
||||||
|
[showRequiredError]="formSubmitClicked"></core-recaptcha>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Site policy (if any). -->
|
<!-- Site policy (if any). -->
|
||||||
|
|
|
@ -60,6 +60,7 @@ export class CoreLoginEmailSignupPage implements OnInit {
|
||||||
settingsLoaded = false;
|
settingsLoaded = false;
|
||||||
allRequiredSupported = true;
|
allRequiredSupported = true;
|
||||||
signupUrl?: string;
|
signupUrl?: string;
|
||||||
|
formSubmitClicked = false;
|
||||||
captcha = {
|
captcha = {
|
||||||
recaptcharesponse: '',
|
recaptcharesponse: '',
|
||||||
};
|
};
|
||||||
|
@ -265,6 +266,8 @@ export class CoreLoginEmailSignupPage implements OnInit {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
|
this.formSubmitClicked = true;
|
||||||
|
|
||||||
if (!this.signupForm.valid || (this.settings?.recaptchapublickey && !this.captcha.recaptcharesponse)) {
|
if (!this.signupForm.valid || (this.settings?.recaptchapublickey && !this.captcha.recaptcharesponse)) {
|
||||||
// Form not valid. Mark all controls as dirty to display errors.
|
// Form not valid. Mark all controls as dirty to display errors.
|
||||||
for (const name in this.signupForm.controls) {
|
for (const name in this.signupForm.controls) {
|
||||||
|
|
Loading…
Reference in New Issue