public static string getToken(string user_id)
 {
     if (string.IsNullOrEmpty(user_id))
     {
         return("");
     }
     return(PassWordService.GetMd5Str(miyao1 + user_id));
 }
Example #2
0
        public JsonResult Userlogin(string userName, string passWord, string validateCode, bool isRemember)
        {
            var result = new JsonResult();
            var cookie = CookieService.GetCookie("Code");

            //if (!validateCode.Equals(cookie))
            //{
            //    result.Data = "验证码验证错误";
            //    return result;
            //}
            Session["sysAdmin"] = null;
            if (isRemember)
            {
                CookieService.SetCookie("uname", userName, 7);
                CookieService.SetCookie("upwd", passWord, 7);
                CookieService.SetCookie("isRemember", isRemember?"1":"0", 7);
            }
            else
            {
                CookieService.ClearCookie("uname");
                CookieService.ClearCookie("upwd");
                CookieService.ClearCookie("isRemember");
            }

            ST_SysAdmin user = new ST_SysAdmin()
            {
                UserName = userName, UserPwd = PassWordService.MD5(passWord)
            };
            var loginUser = St_LogicHelper.UserLogin(user);

            if (loginUser != null)
            {
                Session["sysAdmin"] = loginUser;
                result.Data         = "success";
            }
            else
            {
                result.Data = "用户名或密码错误";
            }
            return(result);
        }