diff --git a/Web/Controllers/UserController.cs b/Web/Controllers/UserController.cs index f74bbef..5f0b053 100644 --- a/Web/Controllers/UserController.cs +++ b/Web/Controllers/UserController.cs @@ -248,10 +248,18 @@ namespace MileageTraker.Web.Controllers { return HttpNotFound(); } - user.IsApproved = false; - DataService.UpdateUser(user); + if (user.Username == User.Identity.Name) + { + TempData["StatusMessage"] = "Cannot disable yourself!"; + TempData["StatusMessage-Type"] = "alert-error"; + } + else + { + user.IsApproved = false; + DataService.UpdateUser(user); - TempData["StatusMessage"] = user.Username + " disabled"; + TempData["StatusMessage"] = user.Username + " disabled"; + } if (Request.UrlReferrer != null) return Redirect(Request.UrlReferrer.AbsolutePath);