From 5b35e0b044bd683066c9b3ac1244ee513bd7522f Mon Sep 17 00:00:00 2001 From: dibakor Date: Mon, 27 Jul 2026 18:16:10 +0600 Subject: [PATCH] show specific message in login --- .../Services/Systems/UserService.cs | 2 +- .../Controllers/Mobile/MobileAuthController.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Api/OnlineSalesAutoCrop.CoreAPI.Services/Services/Systems/UserService.cs b/Api/OnlineSalesAutoCrop.CoreAPI.Services/Services/Systems/UserService.cs index 74350ae..a25e216 100644 --- a/Api/OnlineSalesAutoCrop.CoreAPI.Services/Services/Systems/UserService.cs +++ b/Api/OnlineSalesAutoCrop.CoreAPI.Services/Services/Systems/UserService.cs @@ -407,7 +407,7 @@ namespace OnlineSalesAutoCrop.CoreAPI.Services.Services.Systems { tc.End(); response = new(); - response.IsAuthorized = true; + response.IsAuthorized = false; return response; } diff --git a/Api/OnlineSalesAutoCrop.CoreAPI/Controllers/Mobile/MobileAuthController.cs b/Api/OnlineSalesAutoCrop.CoreAPI/Controllers/Mobile/MobileAuthController.cs index b7537ad..8e9197c 100644 --- a/Api/OnlineSalesAutoCrop.CoreAPI/Controllers/Mobile/MobileAuthController.cs +++ b/Api/OnlineSalesAutoCrop.CoreAPI/Controllers/Mobile/MobileAuthController.cs @@ -102,18 +102,18 @@ namespace OnlineSalesAutoCrop.CoreAPI.Controllers ipAddress = Request.HttpContext.GetIpAddress(); loginReponse = await _service.LoginAsync(request: request, ipAddress: ipAddress); - if (loginReponse == null || loginReponse.UserId == 0) - { - string message = "Login ID/Password is invalid.\" : \"You are not Authorized to login into the System."; - return Unauthorized(MobileResponseBase.Failure(message, StatusCodes.Status401Unauthorized)); - } - if (loginReponse.LoginStatus == EnumLoginStatus.Unsuccessful) { - string message = checkPwd ? $"Login ID/Password is invalid for {request.LoginId}." : "You are not Authorized to login into the System"; + string message = checkPwd ? $"Password is invalid for {request.LoginId}." : "You are not Authorized to login into the System"; return Unauthorized(MobileResponseBase.Failure(message, StatusCodes.Status401Unauthorized)); } + if (loginReponse == null || loginReponse.UserId == 0 || loginReponse.IsAuthorized ==false) + { + string message = "Login ID is invalid.\" : \"You are not Authorized to login into the System."; + return Unauthorized(MobileResponseBase.Failure(message, StatusCodes.Status401Unauthorized)); + } + if (loginReponse.IsLocked) { string message =$"Your Account is locked . Please try again after few minutes";