示例#1
0
        /// <summary>
        /// 验证用户名密码是否正确
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        private AjaxResult ValidateUser(AjaxResult result)
        {
            string   userName = Request["UserName"];
            string   pwd      = Hx.Common.Security.SafeHelper.MD5TwoEncrypt(Request["PassWord"]);
            UserInfo userInfo = this._userService.GetEntity(u => u.PassWord == pwd && (u.UserName == userName || u.Email == userName));

            if (userInfo == null)
            {
                Session[ConstInfo.VCode] = null;
                result.Success           = false;
                result.Message           = "用户名或密码错误!";
            }
            else
            {
                UserContext.CacheUserInfo(userInfo, Helper.IsYes(Request["Remember"]));
            }
            return(result);
        }