LoginController

public class LoginController : Controller
    {
        UserInfoDal userInfoDal = new UserInfoDal();


        // GET: Administration/Login
        public ActionResult Index()
        {
            return View();
        }


        public ActionResult LoginAct(FormCollection collection)
        {

            string LoginName = collection["LoginName"];
            string LoginPassword = collection["LoginPassword"];

            LoginPassword = EncryptionHelper.GetUserPwd(LoginPassword);


            UserInfo userInfo = userInfoDal.Login(LoginName, LoginPassword);

            if (userInfo != null)
            {

                if (userInfo.IsEnable == 0)
                {
                    return Content("1");
                }

                CacheObjHelper.SetUserInfo(userInfo);
                //SessionHelper.SetSession("UserInfo", userInfo);
                //Session["UserInfo"] = userInfo;
                return Json(userInfo, JsonRequestBehavior.AllowGet);
                
            }

            return Content("0");

        }

        public ActionResult LogOut()
        {

            Session.Clear();
            //return View("Index");
            return Redirect("Index");
        }



        public ActionResult test()
        {
            return View();
        }

    }

 

posted @ 2023-04-18 20:37  妖狐鬼魅  阅读(86)  评论(0)    收藏  举报