diff --git a/Backend/Areas/Admin/Data/BaseController.cs b/Backend/Areas/Admin/Data/BaseController.cs index 4a27a57..298e7d3 100644 --- a/Backend/Areas/Admin/Data/BaseController.cs +++ b/Backend/Areas/Admin/Data/BaseController.cs @@ -65,6 +65,16 @@ protected override void OnAuthorization(AuthorizationContext filterContext) }; } + if (obj != null && (obj.RoleId == 2 || obj.RoleId == 1) && (string)currentArea == "" && currentController == "Transactions" && !Request.IsAjaxRequest()) + { + filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new RouteValueDictionary(new + { + action = "Index", + controller = "Home", + area = "Admin" + } + ))); + } string[] AllowedController = { "Logout" }; if (obj != null && (obj.RoleId == 2 || obj.RoleId == 1) && (string)currentArea == "" && !AllowedController.Contains(currentAction) && currentController != "Transactions") diff --git a/Backend/Controllers/HomeController.cs b/Backend/Controllers/HomeController.cs index 84185fc..9344936 100644 --- a/Backend/Controllers/HomeController.cs +++ b/Backend/Controllers/HomeController.cs @@ -281,7 +281,7 @@ public ActionResult CheckLogin(string email, string password) { obj.AttemptLogin++; accounts.Update(obj); - errors.Add("Password", "Your password is wrong!" + obj.AttemptLogin); + errors.Add("Password", "Your password is wrong!"); return Json(new { diff --git a/Backend/Web.config b/Backend/Web.config index 29ccaf4..18ff9c5 100644 --- a/Backend/Web.config +++ b/Backend/Web.config @@ -63,8 +63,8 @@ - - + + diff --git a/OnlineBanking.DAL/Common/Utils.cs b/OnlineBanking.DAL/Common/Utils.cs index 92bf5d3..17da6a0 100644 --- a/OnlineBanking.DAL/Common/Utils.cs +++ b/OnlineBanking.DAL/Common/Utils.cs @@ -45,7 +45,15 @@ public static string HashPassword(string password) public static bool ValidatePassword(string password, string correctHash) { - return BCrypt.Net.BCrypt.Verify(password, correctHash); + try + { + return BCrypt.Net.BCrypt.Verify(password, correctHash); + } + catch (Exception) + { + return false; + } + } } } \ No newline at end of file