|
|
@ -36,6 +36,7 @@ import { SecurityContext } from '@angular/core'; |
|
|
import { AbstractControl, ValidationErrors, Validators } from '@angular/forms'; |
|
|
import { AbstractControl, ValidationErrors, Validators } from '@angular/forms'; |
|
|
|
|
|
|
|
|
const varsRegex = /\${([^}]*)}/g; |
|
|
const varsRegex = /\${([^}]*)}/g; |
|
|
|
|
|
const emailRegex = /^[A-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i; |
|
|
|
|
|
|
|
|
export function onParentScrollOrWindowResize(el: Node): Observable<Event> { |
|
|
export function onParentScrollOrWindowResize(el: Node): Observable<Event> { |
|
|
const scrollSubject = new Subject<Event>(); |
|
|
const scrollSubject = new Subject<Event>(); |
|
|
@ -991,12 +992,6 @@ export const trimDefaultValues = (input: Record<string, any>, defaults: Record<s |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export const validateEmail = (control: AbstractControl): ValidationErrors | null => { |
|
|
export const validateEmail = (control: AbstractControl): ValidationErrors | null => { |
|
|
const email = control.value; |
|
|
return emailRegex.test(control.value) ? null : {email: true}; |
|
|
const nativeEmailError = Validators.email(control); |
|
|
|
|
|
if (nativeEmailError !== null) { |
|
|
|
|
|
return nativeEmailError; |
|
|
|
|
|
} |
|
|
|
|
|
const passesDomainCheck = /\.[^.\s]{2,}$/.test(email); |
|
|
|
|
|
return passesDomainCheck ? null : {email: true}; |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|