From 4af8f66982d93f0206f7b969ac9211b1cefd7ac0 Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Tue, 30 Sep 2025 14:48:13 +0300 Subject: [PATCH] moved to email regex validation --- ui-ngx/src/app/core/utils.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index c824aa26fc..fe974f54a8 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -36,6 +36,7 @@ import { SecurityContext } from '@angular/core'; import { AbstractControl, ValidationErrors, Validators } from '@angular/forms'; const varsRegex = /\${([^}]*)}/g; +const emailRegex = /^[A-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i; export function onParentScrollOrWindowResize(el: Node): Observable { const scrollSubject = new Subject(); @@ -991,12 +992,6 @@ export const trimDefaultValues = (input: Record, defaults: Record { - const email = control.value; - const nativeEmailError = Validators.email(control); - if (nativeEmailError !== null) { - return nativeEmailError; - } - const passesDomainCheck = /\.[^.\s]{2,}$/.test(email); - return passesDomainCheck ? null : {email: true}; + return emailRegex.test(control.value) ? null : {email: true}; };