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
@@ -462,5 +462,30 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpGet("Download")]
public async Task<IActionResult> DownloadAPKFileAsync()
{
try
{
string fileName = "com.nuvolar.wfcapp-Signed.apk";
string downloadFolder = Path.Combine(Directory.GetCurrentDirectory(), "Downloads", "APK");
string filePath = Path.Combine(downloadFolder, fileName);
if (!System.IO.File.Exists(filePath))
{
return NotFound("File not found.");
}
var fileBytes = await System.IO.File.ReadAllBytesAsync(filePath);
var fileType = "application/octet-stream";
return File(fileBytes, fileType, fileName);
}
catch (Exception ex)
{
return StatusCode(500, $"Error: {ex.Message}");
}
}
}
}
@@ -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)
+10
View File
@@ -97,6 +97,16 @@ if (!Directory.Exists(pdfDirectory))
{
Directory.CreateDirectory(pdfDirectory);
}
string downloadDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Downloads");
if (!Directory.Exists(downloadDirectory))
{
Directory.CreateDirectory(downloadDirectory);
}
string downloadAPKDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Downloads","APK");
if (!Directory.Exists(downloadAPKDirectory))
{
Directory.CreateDirectory(downloadAPKDirectory);
}
//---------------------------------------------------------------------------