// // GET: /Authentication/ public JsonResult Login(string mail, string pass) { var authBll = new Domain.BLL.AuthenticationBLL(); var people = authBll.Authorize(mail); if (people == null) { return Json(new { success = false, error = "Email inválido" }, JsonRequestBehavior.AllowGet); } else { if (people.Senha == new Utils.Cryptography.EncryptMd5().GetHash(pass)) { var token = authBll.GetToken(people.ID, 15); //FormsAuthentication.SetAuthCookie(mail, false); //Session.SetLoggedUser(people); return Json(new { success = true, user = new { id = people.ID, token = token.Token, name = people.Nome, lastName = people.Sobrenome } }, JsonRequestBehavior.AllowGet); } else { return Json(new { success = false, error = "Senha inválida" }, JsonRequestBehavior.AllowGet); } } }