Exemplo n.º 1
0
        public ActionResult Login(AccountLoginModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            string          resultStr = "";
            AccountDbModels act       = new AccountDbModels();
            EsmUser         model     = new EsmUser();

            model = act.loginChk(viewModel);                //로그인 체크



            if (model == null)                          //아이디 페스워드 체크
            {
                resultStr         = "이메일 또는 비밀번호를 확인해 주시기 바랍니다.";
                ViewBag.PublicMsg = resultStr;
                return(View(viewModel));
            }

            if (model.STATUS == 0)              //사용 여부 체크
            {
                resultStr         = "사용이 정지된 계정입니다.";
                ViewBag.PublicMsg = resultStr;
                return(View(viewModel));
            }


            FormsAuthentication.SetAuthCookie(viewModel.Email, false);

            Session["MANAGE_NO"]           = model.SEQNO;
            Session["MANAGE_GRADE"]        = model.GROUP_ID;
            Session["CURRENT_LOGIN_EMAIL"] = model.EMAIL;

            //로그인 기록 데이터 세팅
            CommLoginLog clh = new CommLoginLog();

            clh.EMAIL  = viewModel.Email;
            clh.IPADDR = Request.UserHostAddress;

            act.loginHis(clh);                //로그인 로그 기록

            return(RedirectToAction("Index", "Home"));
        }