public ActionResult CheckAuthenticationGmail(string check) { //Kiểm tra DB var data = EncryptTo.Decrypt(check); if (!data.Contains("_")) { return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); } var arr = data.Split('_'); var id_account = int.Parse(arr[0]); var time = DateTime.ParseExact(arr[1], "ddMMyyyyHHmmss", CultureInfo.InvariantCulture); ACCOUNTModel account = new ACCOUNTRepository().GetById(id_account); if (arr[1] == account.thoi_gian_login_gmail) { if (time < DateTime.Now && DateTime.Now < time.AddMinutes(5)) { new ACCOUNTRepository().UpdateThoiGianLoginGmail(id_account, null); USERModel user = SaveLoginInfo(id_account); if (user.ma_role == "admin") { return(RedirectToAction("Index", "PageAdmin")); } if (user.ma_role == "employee") { return(RedirectToAction("Index", "PageUser")); } } return(RedirectToAction("Index", "Login")); } else { return(RedirectToAction("Index", "Login")); } }
public ACCOUNTModel CheckLogin([FromBody] ACCOUNTModel account) { ACCOUNTModel result = new ACCOUNTRepository().CheckLogin(account); return(result); }