/// <summary> /// 修改密码 /// </summary> private string ModifyPassword() { //校验码 string code = _context.Request["code"]; //帐号 string mid = _context.Request["account"]; //域名 string domain = GetDomain(); //帐号 string oldPwd = _context.Request["oldpwd"]; //帐号 string newPwd = _context.Request["newpwd"]; //登录校验码 + 帐号信息 + 密码 //验证结果 + 帐号信息 + 登录随机校验码 string result = joggleBLL.GetCheckCodeValid(mid, code, domain); if (result[0] == '0') { //验证失败 return(CreateReturn("0", "认证失败", "", null)); } else { //验证成功 Model.Member model = BLL.Member.GetModelByMID(mid); //密码修改 if (System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(oldPwd + model.Salt, "MD5").ToUpper() == model.Password) { model.Password = newPwd; model.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(model.Password + model.Salt, "MD5").ToUpper(); BLL.Member bll = new BLL.Member(); if (bll.Update(model)) { return(CreateReturn("4", "密码修改成功", result.Substring(1), model)); } else { model = BLL.Member.GetModelByMID(mid); return(CreateReturn("5", "修改失败", result.Substring(1), model)); } } else { return(CreateReturn("5", "原密码不正确", result.Substring(1), model)); } } }