forked from ddrilling/AsbCloudServer
Auth controller very minor changes
This commit is contained in:
parent
387b01c44d
commit
1d26c3dc9d
@ -75,7 +75,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
if (userDto.Password.Length < 3)
|
if (userDto.Password.Length < 3)
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
if (userDto.Email.Length is > 255)
|
if (userDto.Email.Length > 255)
|
||||||
return -3;
|
return -3;
|
||||||
|
|
||||||
if (userDto.Phone.Length > 50)
|
if (userDto.Phone.Length > 50)
|
||||||
|
@ -63,7 +63,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
{
|
{
|
||||||
const string roleName = "Администратор";
|
const string roleName = "Администратор";
|
||||||
if (!User.IsInRole(roleName))
|
if (!User.IsInRole(roleName))
|
||||||
return Forbid($"You mast be an {roleName}.");
|
return Forbid($"You must be in {roleName}.");
|
||||||
|
|
||||||
var code = authService.Register(user);
|
var code = authService.Register(user);
|
||||||
return code switch
|
return code switch
|
||||||
@ -90,7 +90,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
var allow = (User.GetUserId() == idUser) || User.IsInRole(roleName);
|
var allow = (User.GetUserId() == idUser) || User.IsInRole(roleName);
|
||||||
|
|
||||||
if (!allow)
|
if (!allow)
|
||||||
return Forbid($"You mast be an {roleName} or user with id:{idUser}.");
|
return Forbid($"You must be an {roleName} or user with id:{idUser}.");
|
||||||
|
|
||||||
var code = authService.ChangePassword(idUser, newPassword);
|
var code = authService.ChangePassword(idUser, newPassword);
|
||||||
return code switch
|
return code switch
|
||||||
|
Loading…
Reference in New Issue
Block a user