Beispiel #1
0
        public ActionResult DeleteAccout(string pass)
        {
            HttpCookie    objRequestRead = Request.Cookies["auth"];
            Autentication JWT            = new Autentication();

            if (objRequestRead != null && objRequestRead["jwt"] != null && JWT.ValidateSession(objRequestRead["jwt"], objRequestRead["username"]))
            {
                string loggedUser = objRequestRead["username"];
                if (User.DeleteMyAccount(loggedUser, pass).Equals("Usuario eliminado correctamente"))
                {
                    var deleteMyMessages = new MessagesLogic();
                    var IAmDone          = deleteMyMessages.DeleteMessages(loggedUser);
                    objRequestRead.Values["jwt"] = "400";
                    Response.Cookies.Add(objRequestRead);
                    return(RedirectToAction("LogInUser"));
                }
                else
                {
                    return(RedirectToAction("Index", "Chats"));
                }
            }
            else
            {
                return(RedirectToAction("Error", "Chats"));
            }
        }