Esempio n. 1
0
        public JsonResult Login(LoginModel model)
        {
            GoToViewModel gotoViewModel = new GoToViewModel();

            gotoViewModel.Url = ManagerConfig.GetLoginPage();


            LoginManager <SysStaffUser> loginManager = new LoginManager <SysStaffUser>();

            var result = loginManager.SignIn(model.UserName, model.Password, CommonUtils.GetIP(), Enumeration.LoginType.Website);


            if (result.ResultType == Enumeration.LoginResult.Failure)
            {
                if (result.ResultTip == Enumeration.LoginResultTip.UserNotExist || result.ResultTip == Enumeration.LoginResultTip.UserPasswordIncorrect)
                {
                    return(Json(ResultType.Failure, gotoViewModel, ManagerOperateTipUtils.LOGIN_USERNAMEORPASSWORDINCORRECT));
                }

                if (result.ResultTip == Enumeration.LoginResultTip.UserDisabled)
                {
                    return(Json(ResultType.Failure, gotoViewModel, ManagerOperateTipUtils.LOGIN_ACCOUNT_DISABLED));
                }

                if (result.ResultTip == Enumeration.LoginResultTip.UserDeleted)
                {
                    return(Json(ResultType.Failure, gotoViewModel, ManagerOperateTipUtils.LOGIN_ACCOUNT_DELETE));
                }
            }

            gotoViewModel.Url = ManagerConfig.GetHomePage();
            return(Json(ResultType.Success, gotoViewModel, ManagerOperateTipUtils.LOGIN_SUCCESS));
        }
Esempio n. 2
0
        public ActionResult Login()
        {
            Session["ManagerLoginVerifyCode"] = null;
            if (Request.IsAuthenticated)
            {
                if (Request.QueryString["out"] == null)
                {
                    return(Redirect(ManagerConfig.GetHomePage()));
                }
            }

            return(View());
        }