public ActionResult Login(string username, string password) { UserAuth user = new UserAuth() { username = username, password = password }; var auth = PostHelper <UserAuth> .GetToken(Globals.USER_VALIDATE_API_LINK, user); if (auth != null && auth != "Wrong password or username") { Globals.Token = auth; } return(RedirectToAction("Index", "Home")); }
public ActionResult Login(string username, string password) { User user = new User() { username = username, password = password }; var auth = PostHelper <User> .GetToken(Globals.USER_VALIDATE_API_LINK, user); if (auth != null && auth != "Wrong password or username") { HttpCookie cookie = new HttpCookie("Bearer"); cookie.Value = auth.ToString(); cookie.Expires = DateTime.Now.AddMinutes(15); Response.Cookies.Add(cookie); } return(RedirectToAction("Index", "Home")); }