NFC azonosítás is kész

This commit is contained in:
2025-04-06 14:42:34 +02:00
parent dc3e6e2f7b
commit 66744e0526
17 changed files with 1329 additions and 62 deletions
@@ -139,6 +139,53 @@ namespace WorkFlowCheck.API.Controllers
}
return retVal;
}
[HttpPost("AuthenticateNFC")]
public async Task<ApiResponseDTO<UserDTO>> AuthenticateNFC([FromBody] UserSimpleDTO userSimpleDTO)
{
var retVal = new ApiResponseDTO<UserDTO>()
{
IsSuccess = true
};
if (string.IsNullOrEmpty(userSimpleDTO.UserName) || string.IsNullOrEmpty(userSimpleDTO.Password))
{
retVal.IsSuccess = false;
retVal.Errors.Add("Nem megfelelo felhasználói név vagy jelszó");
return retVal;
}
try
{
var userDTO_Response = await _userService.Authenticate(userSimpleDTO.UserName, userSimpleDTO.Password);
if (userDTO_Response != null)
{
if (string.IsNullOrEmpty(userDTO_Response.UserName) == false && userDTO_Response.UserName == userSimpleDTO.UserName)
{
retVal.IsSuccess = true;
retVal.Data = userDTO_Response;
Log.Information($"Sikeres azonosítás! {userSimpleDTO.UserName}");
}
else
{
var error = $"Nem megfelelo felhasználó vagy jelszó! {userSimpleDTO.UserName}";
retVal.IsSuccess = false;
retVal.Errors.Add(error);
Log.Information(error);
}
}
else
{
var error = $"Nem megfelelo felhasználó vagy jelszó! {userSimpleDTO.UserName}";
retVal.IsSuccess = false;
retVal.Errors.Add(error);
Log.Information(error);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetRole/{id}")]
public async Task<ApiResponseDTO<RoleDTO>> GetRole(int id)