Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added noWhitespaceValidator #13168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { AbstractControl, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { ReCaptcha2Component } from 'ngx-captcha';
import { finalize } from 'rxjs/operators';
import { environment } from '../../../environments/environment';
Expand Down Expand Up @@ -41,6 +41,16 @@
});
}

/**
* Custom validator to disallow whitespace-only values.

Check warning on line 45 in src/web/app/pages-help/session-links-recovery/session-links-recovery-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Expected JSDoc block to be aligned

Check warning on line 45 in src/web/app/pages-help/session-links-recovery/session-links-recovery-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Expected JSDoc block to be aligned

Check warning on line 45 in src/web/app/pages-help/session-links-recovery/session-links-recovery-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Expected JSDoc block to be aligned

Check warning on line 45 in src/web/app/pages-help/session-links-recovery/session-links-recovery-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Expected JSDoc block to be aligned
*/
noWhitespaceValidator(control: AbstractControl): { [key: string]: boolean } | null {
if (control.value && control.value.trim().length === 0) {
return { 'whitespace': true };

Check failure on line 49 in src/web/app/pages-help/session-links-recovery/session-links-recovery-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Unnecessarily quoted property 'whitespace' found

Check failure on line 49 in src/web/app/pages-help/session-links-recovery/session-links-recovery-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Unnecessarily quoted property 'whitespace' found

Check failure on line 49 in src/web/app/pages-help/session-links-recovery/session-links-recovery-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Unnecessarily quoted property 'whitespace' found

Check failure on line 49 in src/web/app/pages-help/session-links-recovery/session-links-recovery-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Unnecessarily quoted property 'whitespace' found
}
return null;
}

/**
* Sends the feedback session links to the recovery email address.
*/
Expand Down
Loading