protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
            var temp = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name;

            loginedUser = new USERModel();
            loginedUser.ma_nguoi_dung     = EncryptTo.Encrypt(temp.Split('_')[0]);
            loginedUser.ho_ten_nguoi_dung = temp.Split('_')[1];
        }
Exemplo n.º 2
0
        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 ActionResult UpdateProfile(USERModel user)
        {
            var i = 0;

            return(Json(new { success = true }));
        }
Exemplo n.º 4
0
 public ACCOUNTModel GetAccount([FromBody] USERModel user)
 {
     return(new ACCOUNTRepository().GetByMaUser(EncryptTo.Decrypt(user.ma_nguoi_dung)));
 }
Exemplo n.º 5
0
 public USERModel GetProfile([FromBody] USERModel user)
 {
     return(new USERRepository().GetByMaUser(EncryptTo.Decrypt(user.ma_nguoi_dung)));
 }
Exemplo n.º 6
0
 public bool Update(USERModel model)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 public bool Insert(USERModel model)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 8
0
        public JsonResult SaveLogin(int id_account)
        {
            USERModel user = SaveLoginInfo(id_account);

            return(Json(user, JsonRequestBehavior.AllowGet));
        }