NFC azonosítás is kész
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user