регулярки надо затестить
This commit is contained in:
parent
ed47c9c6e8
commit
cd04a4dc87
@ -4,6 +4,7 @@ using SushiBarContracts.BusinessLogicsContracts;
|
||||
using SushiBarContracts.SearchModels;
|
||||
using SushiBarContracts.StoragesContracts;
|
||||
using SushiBarContracts.ViewModels;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SushiBarBusinessLogic.BusinessLogics
|
||||
{
|
||||
@ -105,6 +106,14 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException("Нет пароля клиента", nameof(model.Password));
|
||||
}
|
||||
if (!Regex.IsMatch(model.Email, @"^[^@\s]+@[^@\s]+\.[^@\s]+$", RegexOptions.IgnoreCase))
|
||||
{
|
||||
throw new ArgumentException("Неправильно введенный email", nameof(model.Email));
|
||||
}
|
||||
if (!Regex.IsMatch(model.Password, @"^^((\w+\d+\W+)|(\w+\W+\d+)|(\d+\w+\W+)|(\d+\W+\w+)|(\W+\w+\d+)|(\W+\d+\w+))[\w\d\W]*$", RegexOptions.IgnoreCase))
|
||||
{
|
||||
throw new ArgumentException("Неправильно введенный пароль", nameof(model.Password));
|
||||
}
|
||||
_logger.LogInformation("Client. ClientFIO: {ClientFIO}. Email: {Email}. Id: {Id}",
|
||||
model.ClientFIO, model.Email, model.Id);
|
||||
var element = _clientStorage.GetElement(new ClientSearchModel
|
||||
|
Loading…
Reference in New Issue
Block a user