forked from ddrilling/AsbCloudServer
CS2-72: Added email, phone and position in UserDto.
This commit is contained in:
parent
e92859439e
commit
387b01c44d
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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(),
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user