Beispiel #1
0
        public ActionResult Login(string username, string password)
        {
            var loginInfo = new LoginBll().Login(username, password);

            if (loginInfo != null && loginInfo.Id > 0)
            {
                string data = JsonConvert.SerializeObject(loginInfo);
                CookieHelper.SetCookie("Context_UserInfo", AESHelp.AESEncrypt(DesHelper.Encode(data, DesHelper.SECRET)));
                return(Redirect(ViewBag.RootNode + "/Home/Index"));
            }
            ModelState.AddModelError("error", "用户名或密码错误");
            return(View());
        }
 public static bool setPasswordConfigBO(PasswordConfigBO pBO)
 {
     try
     {
         InIHelper.WriteConfig(pBO.key, "isDefaultPassword", pBO.isDefaultPassword.ToString());
         InIHelper.WriteConfig(pBO.key, "isPasswordPrompt", pBO.isPasswordPrompt.ToString());
         InIHelper.WriteConfig(pBO.key, "passwordPrompt", pBO.passwordPrompt);
         InIHelper.WriteConfig(pBO.key, "enterDirectly", pBO.enterDirectly.ToString());
         InIHelper.WriteConfig(pBO.key, "defaultPassword", DesHelper.Encode(pBO.defaultPassword));
         return(true);
     }
     catch
     {
         return(false);
     }
 }