CS2-72: Added email, phone and position in UserDto.

This commit is contained in:
KharchenkoVladimir 2021-10-19 15:22:18 +05:00
parent e92859439e
commit 387b01c44d
3 changed files with 21 additions and 0 deletions

View File

@ -11,5 +11,11 @@
public string Surname { get; set; }
public string Patronymic { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string Position { get; set; }
}
}

View File

@ -74,6 +74,15 @@ namespace AsbCloudInfrastructure.Services
if (userDto.Password.Length < 3)
return -2;
if (userDto.Email.Length is > 255)
return -3;
if (userDto.Phone.Length > 50)
return -4;
if (userDto.Position.Length > 255)
return -5;
var salt = GenerateSalt();
@ -84,6 +93,9 @@ namespace AsbCloudInfrastructure.Services
Name = userDto.Name,
Surname = userDto.Surname,
Patronymic = userDto.Patronymic,
Email = userDto.Email,
Phone = userDto.Phone,
Position = userDto.Position,
Level = userDto.Level,
Login = userDto.Login,
PasswordHash = salt + ComputeHash(salt, userDto.Password)

View File

@ -71,6 +71,9 @@ namespace AsbCloudWebApi.Controllers
0 => Ok(),
-1 => BadRequest("Логин должен быть длиннее 3х знаков."),
-2 => BadRequest("Пароль должен быть длиннее 3х знаков."),
-3 => BadRequest("Email не должен быть длиннее 255 знаков."),
-4 => BadRequest("Телефон не должен быть длиннее 50 знаков."),
-5 => BadRequest("Название должности не должно быть длиннее 255 символов."),
_ => BadRequest(),
};
}