Example #1
0
        public string CheckLoginAjacMVC(FormCollection fc)
        {
            string username = fc["usName"].ToString();
            string password = fc["paWord"].ToString();

            Cwrs.DataBase.Models.UserTLVN user = _common.CheckLogin(username, password);
            if (user != null)
            {
                Response.Cookies["TLVNAppToken"].Value   = "VHLH";
                Response.Cookies["TLVNAppToken"].Expires = DateTime.Now.AddDays(7);
                FormsAuthentication.SetAuthCookie(user.UserId + "|" + user.UserName + "|" + user.FullName + "|" + user.RoleRef + "|" + user.IsAdminBitType + "|" + user.GroupRef, true);

                if (!_common.CheckAdmin())
                {
                    return("/FileUpload/Index");
                }
                else
                {
                    return("/Download/Index");
                }
            }
            else
            {
                return("0");
            }
        }
Example #2
0
        /// <summary>
        /// HiemTM: Kiểm tra thông tin đăng nhập từ TLVN
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public string CheckLogin(string username, string password)
        {
            Cwrs.DataBase.Models.UserTLVN user = _common.CheckLogin(username, password);
            if (user != null)
            {
                Response.Cookies["TLVNAppToken"].Value   = "VHLH";
                Response.Cookies["TLVNAppToken"].Expires = DateTime.Now.AddDays(7);

                string stringJson = JsonConvert.SerializeObject(user);
                // FormsAuthentication.SetAuthCookie(user.UserId + "|" + user.UserName + "|" + user.FullName + "|" + user.RoleRef + "|" + user.IsAdminBitType + "|" + user.GroupRef, true);
                FormsAuthentication.SetAuthCookie(stringJson, true);

                return("/Home/Index");
                //if (!_common.CheckAdmin())
                //{
                //    return "/FileUpload/Index";
                //}
                //else
                //{
                //    return "/Download/Index";
                //}
            }
            else
            {
                return("0");
            }
        }