From 21624a835b8fa41048a9cba0b648c0b485b73b48 Mon Sep 17 00:00:00 2001 From: mahan Date: Mon, 22 Dec 2025 12:16:47 +0330 Subject: [PATCH] fix: update time restrictions for entry and exit registration to 5 minutes --- .../Repository/RollCallRepository.cs | 2 +- .../Camera/Controllers/CameraController.cs | 38 ++++++++++++++++--- .../Areas/Camera/Pages/Index.cshtml.cs | 4 +- ServiceHost/Properties/launchSettings.json | 2 +- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/RollCallRepository.cs b/CompanyManagment.EFCore/Repository/RollCallRepository.cs index b76e01b8..60bf1b3e 100644 --- a/CompanyManagment.EFCore/Repository/RollCallRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallRepository.cs @@ -1425,7 +1425,7 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos public string CheckRepeat(long employeeId, long workshopId) { - var validSpan = new TimeSpan(0, 0, 2, 0); + var validSpan = new TimeSpan(0, 0, 5, 0); var checkDate = DateTime.Now.AddDays(-3); var query = _context.RollCalls .Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.CreationDate >= checkDate); diff --git a/ServiceHost/Areas/Camera/Controllers/CameraController.cs b/ServiceHost/Areas/Camera/Controllers/CameraController.cs index e0b7e979..a1045794 100644 --- a/ServiceHost/Areas/Camera/Controllers/CameraController.cs +++ b/ServiceHost/Areas/Camera/Controllers/CameraController.cs @@ -145,10 +145,10 @@ public class CameraController : CameraBaseController switch (repeatStatus) { case "IncomRegistred-InvalidOut": - throw new BadRequestException("شما به تازگی ثبت ورود نموده اید ,تا 2 دقیقه نمی توانید ثبت خروج نمایید"); + throw new BadRequestException("شما به تازگی ثبت ورود نموده اید ,تا 5 دقیقه نمی توانید ثبت خروج نمایید"); case "outRegistred-InvalidIncom": - throw new BadRequestException("شما به تازگی ثبت خروج نموده اید تا 2 دقیقه نمی توانید ثبت ورود نمایید"); + throw new BadRequestException("شما به تازگی ثبت خروج نموده اید تا 5 دقیقه نمی توانید ثبت ورود نمایید"); } @@ -201,10 +201,10 @@ public class CameraController : CameraBaseController switch (repeatStatus) { case "IncomRegistred-InvalidOut": - throw new BadRequestException("شما به تازگی ثبت ورود نموده اید ,تا 2 دقیقه نمی توانید ثبت خروج نمایید"); + throw new BadRequestException("شما به تازگی ثبت ورود نموده اید ,تا 5 دقیقه نمی توانید ثبت خروج نمایید"); case "outRegistred-InvalidIncom": - throw new BadRequestException("شما به تازگی ثبت خروج نموده اید تا 2 دقیقه نمی توانید ثبت ورود نمایید"); + throw new BadRequestException("شما به تازگی ثبت خروج نموده اید تا 5 دقیقه نمی توانید ثبت ورود نمایید"); } @@ -302,13 +302,13 @@ public class CameraController : CameraBaseController return new JsonResult(new { isSuccess = false, - message = "شما به تازگی ثبت ورود نموده اید ,تا 2 دقیقه نمی توانید ثبت خروج نمایید", + message = "شما به تازگی ثبت ورود نموده اید ,تا 5 دقیقه نمی توانید ثبت خروج نمایید", }); case "outRegistred-InvalidIncom": return new JsonResult(new { isSuccess = false, - message = "شما به تازگی ثبت خروج نموده اید تا 2 دقیقه نمی توانید ثبت ورود نمایید", + message = "شما به تازگی ثبت خروج نموده اید تا 5 دقیقه نمی توانید ثبت ورود نمایید", }); } @@ -412,6 +412,32 @@ public class CameraController : CameraBaseController }); } } + + + [HttpPost("check-password")] + public IActionResult OnPostCheckPassword([FromBody]string password) + { + var cameraAccount = _authHelper.CameraAccountInfo(); + var cameraPassword = _cameraAccountApplication.GetDetails(cameraAccount.Id).Password; + (bool Verified, bool NeedUpgrade) result = _passwordHasher.Check(cameraPassword, password); + if (result.Verified) + { + _accountApplication.Logout(); + return new JsonResult(new + { + isSuccess = true, + + }); + } + + return new JsonResult(new + { + isSuccess = false, + errorMessage = "گذرواژه اشتباه است", + }); + + + } } public class RollCallExitRequest:RollCallEnterRequest diff --git a/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs b/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs index 0586e82f..23b8ca40 100644 --- a/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs +++ b/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs @@ -139,13 +139,13 @@ public class IndexModel : PageModel return new JsonResult(new { isSuccess = false, - message = "شما به تازگی ثبت ورود نموده اید ,تا 2 دقیقه نمی توانید ثبت خروج نمایید", + message = "شما به تازگی ثبت ورود نموده اید ,تا 5 دقیقه نمی توانید ثبت خروج نمایید", }); case "outRegistred-InvalidIncom": return new JsonResult(new { isSuccess = false, - message = "شما به تازگی ثبت خروج نموده اید تا 2 دقیقه نمی توانید ثبت ورود نمایید", + message = "شما به تازگی ثبت خروج نموده اید تا 5 دقیقه نمی توانید ثبت ورود نمایید", }); } diff --git a/ServiceHost/Properties/launchSettings.json b/ServiceHost/Properties/launchSettings.json index 788962e4..d7381591 100644 --- a/ServiceHost/Properties/launchSettings.json +++ b/ServiceHost/Properties/launchSettings.json @@ -19,7 +19,7 @@ "sqlDebugging": true, "dotnetRunMessages": "true", "nativeDebugging": true, - "applicationUrl": "https://localhost:5004;http://localhost:5003;", + "applicationUrl": "https://localhost:5004;http://localhost:5003;https://192.168.0.117:5006", "jsWebView2Debugging": false, "hotReloadEnabled": true },