/// <summary> /// 设置密码 /// </summary> /// <param name="context"></param> public void ResPwd(HttpContext context) { string userName = HttpContext.Current.Request.Form["UserName"]; string phoneCode = HttpContext.Current.Request.Form["phoneCode"]; string code = HttpContext.Current.Request.Form["code"]; show_userBll bll = new show_userBll(); //是否由此用户名 if (!bll.CheckUserNname(userName)) { context.Response.Write("{\"status\":\"-4\"}"); return; } //获取验证码 string dbyzm = bll.GetCode(userName); if (dbyzm != phoneCode) { context.Response.Write("{\"status\":\"-2\"}"); return; } string pwd = HttpContext.Current.Request.Form["pwd"]; bll.UpdatePwd(userName, pwd); context.Response.Write("{\"status\":\"0\"}"); }
/// <summary> /// 手机重置密码 -1为验证码不正确 -2为手机验证码不正确 -3为验证码过期 /// </summary> /// <param name="context"></param> public void SetPwd_phone(HttpContext context) { string userName = HttpContext.Current.Request.Form["UserName"]; string phoneCode = HttpContext.Current.Request.Form["phoneCode"]; string code = HttpContext.Current.Request.Form["code"]; show_userBll bll = new show_userBll(); //是否由此用户名 if (!bll.CheckUserNname(userName)) { context.Response.Write("{\"status\":\"-4\"}"); return; } if (HttpContext.Current.Session["code"] == null) { context.Response.Write("{\"status\":\"-3\"}"); return; } if (code != HttpContext.Current.Session["code"].ToString()) { context.Response.Write("{\"status\":\"-1\"}"); return; } //获取验证码 string dbyzm = bll.GetCode(userName); if (dbyzm != phoneCode) { context.Response.Write("{\"status\":\"-2\"}"); return; } context.Response.Write("{\"status\":\"0\"}"); }
/// <summary> /// 邮箱修改密码 /// </summary> /// <param name="context"></param> public void SetPwd_Email(HttpContext context) { string userName = HttpContext.Current.Request.Form["UserName"]; string code = HttpContext.Current.Request.Form["code"]; show_userBll bll = new show_userBll(); //是否由此用户名 if (!bll.CheckUserNname(userName)) { context.Response.Write("{\"status\":\"-4\"}"); return; } if (HttpContext.Current.Session["code"] == null) { context.Response.Write("{\"status\":\"-3\"}"); return; } if (code != HttpContext.Current.Session["code"].ToString()) { context.Response.Write("{\"status\":\"-1\"}"); return; } f.SendEmail(userName, Guid.NewGuid().ToString(), 1); context.Response.Write("{\"status\":\"0\"}"); }