From 21aafb9639663b48427c0fa0dca0b38e67ac087d Mon Sep 17 00:00:00 2001 From: russell Date: Wed, 29 May 2024 14:28:43 +0400 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D0=B3=D1=83=D0=BB=D1=8F=D1=80?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BD=D0=B0=20=D0=BF=D0=BE=D1=87=D1=82=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TravelAgencyBusinessLogic/BusinessLogics/UserLogic.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TravelAgency/TravelAgencyBusinessLogic/BusinessLogics/UserLogic.cs b/TravelAgency/TravelAgencyBusinessLogic/BusinessLogics/UserLogic.cs index cfdf395..0f1ffc3 100644 --- a/TravelAgency/TravelAgencyBusinessLogic/BusinessLogics/UserLogic.cs +++ b/TravelAgency/TravelAgencyBusinessLogic/BusinessLogics/UserLogic.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using System.Text.RegularExpressions; using TravelAgencyContracts.BindingModels; using TravelAgencyContracts.BusinessLogicsContracts; using TravelAgencyContracts.SearchModels; @@ -97,9 +98,9 @@ namespace TravelAgencyBusinessLogic.BusinessLogics { throw new ArgumentNullException("Нет ФИО пользователя", nameof(model.UserFIO)); } - if (string.IsNullOrEmpty(model.Email)) + if (string.IsNullOrEmpty(model.Email) || !Regex.IsMatch(model.Email, @"^[a-z0-9._%+-]+\@([a-z0-9-]+\.)+[a-z]{2,4}$")) { - throw new ArgumentNullException("Нет логина(почты) пользователя", nameof(model.Email)); + throw new ArgumentNullException("Некорректно введен логин(почта) пользователя", nameof(model.Email)); } if (string.IsNullOrEmpty(model.PhoneNumber)) {