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)) {