forked from ddrilling/AsbCloudServer
Added register params validation
This commit is contained in:
parent
9fea1c94a6
commit
6b2c4a359b
@ -69,19 +69,19 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
public int Register(UserDto userDto)
|
||||
{
|
||||
if (userDto.Login.Length < 3)
|
||||
if (userDto.Login is null || userDto.Login.Length is < 3 or > 50)
|
||||
return -1;
|
||||
|
||||
if (userDto.Password.Length < 3)
|
||||
if (userDto.Password is null || userDto.Password.Length is < 3 or > 50)
|
||||
return -2;
|
||||
|
||||
if (userDto.Email.Length > 255)
|
||||
if (userDto.Email?.Length > 255)
|
||||
return -3;
|
||||
|
||||
if (userDto.Phone.Length > 50)
|
||||
if (userDto.Phone?.Length > 50)
|
||||
return -4;
|
||||
|
||||
if (userDto.Position.Length > 255)
|
||||
if (userDto.Position?.Length > 255)
|
||||
return -5;
|
||||
|
||||
var salt = GenerateSalt();
|
||||
|
@ -54,8 +54,9 @@ namespace AsbCloudWebApi.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Регистрация пользователя. Доступна администратору
|
||||
/// Отправить заявку на регистрацию. Заявка подтверждается администратором.
|
||||
/// </summary>
|
||||
/// <param name="user">Информация о новом пользователе</param>
|
||||
/// <returns code="200">Ок</returns>
|
||||
[HttpPost]
|
||||
public IActionResult Register(UserDto user)
|
||||
|
Loading…
Reference in New Issue
Block a user