redo
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
using back.DataModels;
|
||||
using back.DTO;
|
||||
using back.services.bussines;
|
||||
using back.services.bussines.UserService;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace back.controllers;
|
||||
@@ -46,14 +44,14 @@ public class UsersController(IUserService user) : ControllerBase
|
||||
if (user == null || string.IsNullOrEmpty(user.Email) || string.IsNullOrEmpty(user.Password))
|
||||
return BadRequest(Errors.BadRequest.Description);
|
||||
|
||||
if (user.Email.Equals(DataModels.User.SystemUser.Email, StringComparison.InvariantCultureIgnoreCase))
|
||||
if (user.Email.Equals(DataModels.User.SystemUser.Email, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
if (string.IsNullOrEmpty(user.SystemKey))
|
||||
return Unauthorized(Errors.Unauthorized.Description);
|
||||
var systemUser = await _user.ValidateSystemUser(user.Email, user.Password, user.SystemKey, clientId);
|
||||
if (systemUser == null)
|
||||
return Unauthorized(Errors.Unauthorized.Description);
|
||||
return Ok(systemUser.Adapt<UserDto>());
|
||||
return Ok(systemUser.ToDto());
|
||||
}
|
||||
|
||||
var existingUser = await _user.Login(user.Email, user.Password, clientId);
|
||||
@@ -74,7 +72,7 @@ public class UsersController(IUserService user) : ControllerBase
|
||||
// POST api/<UsersController>
|
||||
[HttpPost("[action]")]
|
||||
public async Task<IActionResult> Register(
|
||||
[FromHeader(Name = "X-client-thumbprint")] string clientId,
|
||||
[FromHeader(Name = "X-client-thumbprint")] string clientId,
|
||||
[FromBody] RegisterFromModel user)
|
||||
{
|
||||
if (user == null)
|
||||
|
Reference in New Issue
Block a user