Esempio n. 1
0
        public async Task<ActionResult> Index(LoginViewModel loginViewModel)
        {
            if (Session[Global.UserLogo] == null)
            {
                base.SetLogo("bi_main.png", "Login");
            }

            if (!ModelState.IsValid)
            {
                return View(loginViewModel);
            }

            ScUsr scUsr = await _scUsrService.SelectScUsr(loginViewModel.ID);
            if (scUsr != null)
            {
                //패스워드비교
                SHACryptography sha2 = new SHACryptography();
                if (scUsr.LoginPw == sha2.EncryptString(loginViewModel.Password))
                //if (user.LOGIN_PW == param.LOGIN_PW)
                {
                    base.LogOn(scUsr);
                    switch (scUsr.UsrType)
                    {
                        case Global.Company: //기업
                            return RedirectToAction("index", "Company/Main");
                        case Global.Mentor: //멘토
                            return RedirectToAction("index", "Mentor/Main");
                        case Global.Expert: //전문가
                            return RedirectToAction("index", "Expert/Main");
                        case Global.SysManager: //SCP
                            return RedirectToAction("index", "SysManager/Main");
                        case Global.BizManager: //사업관리자
                            return RedirectToAction("index", "BizManager/Main");
                        default:
                            ModelState.AddModelError("", "정의되지 않은 사용자 타입입니다.");
                            return View(loginViewModel);
                    }

                }
                else
                {
                    ModelState.AddModelError("", "비밀번호가 일치하지 않습니다.");
                    return View(loginViewModel);
                }
            }
            else
            {
                ModelState.AddModelError("", "아이디가 존재하지 않습니다.");
                return View(loginViewModel);
            }
        }
Esempio n. 2
0
        public ActionResult Login(string loginId = null)
        {
            if (Session[Global.UserLogo] == null)
            {
                base.SetLogo("bi_main.png", "Login");
            }

            if(loginId == null)
                return View();
            else
            {
                LoginViewModel lvm = new LoginViewModel();
                lvm.ID = loginId;
                return View(lvm);
            }
        }
Esempio n. 3
0
 public ActionResult SearchPassword(string loginId = null)
 {
     if (loginId == null)
         return View();
     else
     {
         LoginViewModel lvm = new LoginViewModel();
         lvm.ID = loginId;
         return View(lvm);
     }
 }
 public async Task<ActionResult> DoLogin(LoginViewModel loginViewModel)
 {
     ScUsr scUsr = await _scUsrService.SelectScUsr(loginViewModel.ID);
     if (scUsr != null)
     {
         //패스워드비교
         SHACryptography sha2 = new SHACryptography();
         if (scUsr.LoginPw == sha2.EncryptString(loginViewModel.Password))
         //if (user.LOGIN_PW == param.LOGIN_PW)
         {
             //base.LogOn(scUsr);
             //string usrType = user.USR_TYPE;
             switch(scUsr.UsrType)
             {
                 case "C": //기업
                     return RedirectToAction("index", "Commany/Main");
                 case "M": //멘토
                     return RedirectToAction("index", "Mentor/Main");
                 case "P": //전문가
                     return RedirectToAction("index", "Expert/Main");
                 case "S": //SCP
                     return RedirectToAction("index", "SysManager/Main");
                 case "B": //사업관리자
                     return RedirectToAction("index", "BizManager/Main");
                 default:
                     return RedirectToAction("index", "Home");
             }
             
         }
         else
         {
             return RedirectToAction("index", "Home");
         }
     }
     else
     {
         return RedirectToAction("index", "Home");
     }
 }