Skip to content

Commit

Permalink
Merge pull request #157 from xdorro/minh
Browse files Browse the repository at this point in the history
Minh
  • Loading branch information
mizhm authored Aug 26, 2021
2 parents 522822c + b137a22 commit fac3196
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions Backend/Areas/Admin/Data/BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion Backend/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
10 changes: 9 additions & 1 deletion OnlineBanking.DAL/Common/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}
}
}

0 comments on commit fac3196

Please sign in to comment.