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