Exemplo n.º 1
0
        public RedirectToRouteResult OnLogin(Credentials credentials)
        {
            try
            {
                User principal = _accountService.AuthenticateUser(credentials);

                HttpContext.Session.Add("principal", principal);
                HttpContext.Session.Add("isLoggedIn", true);

                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception e)
            {
                ViewBag.Error = e.Message;
                Console.WriteLine(e.StackTrace);
                return(RedirectToAction("Login"));
            }
        }