/// <summary> /// 验证找回密码手机 /// </summary> public ActionResult VerifyFindPwdMobile() { int uid = WebHelper.GetQueryInt("uid"); string mobileCode = WebHelper.GetFormString("mobileCode"); PartUserInfo partUserInfo = Users.GetPartUserById(uid); if (partUserInfo == null) { return(AjaxResult("nouser", "用户不存在")); } if (partUserInfo.Mobile.Length == 0) { return(AjaxResult("nocanfind", "由于您没有设置手机,所以不能通过手机找回此账号的密码")); } //检查手机码 if (string.IsNullOrWhiteSpace(mobileCode)) { return(AjaxResult("emptymobilecode", "手机验证码不能为空")); } else if (Sessions.GetValueString(WorkContext.Sid, "findPwdMoibleCode") != mobileCode) { return(AjaxResult("wrongmobilecode", "手机验证码不正确")); } string v = MallUtils.AESEncrypt(string.Format("{0},{1},{2}", partUserInfo.Uid, DateTime.Now, Randoms.CreateRandomValue(6))); string url = string.Format("http://{0}{1}", Request.Url.Authority, Url.Action("resetpwd", new RouteValueDictionary { { "v", v } })); return(AjaxResult("success", url)); }
/// <summary> /// 发送找回密码邮件 /// </summary> public ActionResult SendFindPwdEmail() { int uid = WebHelper.GetQueryInt("uid"); PartUserInfo partUserInfo = Users.GetPartUserById(uid); if (partUserInfo == null) { return(AjaxResult("nouser", "用户不存在")); } if (partUserInfo.Email.Length == 0) { return(AjaxResult("nocanfind", "由于您没有设置邮箱,所以不能通过邮箱找回此账号的密码")); } //发送找回密码邮件 string v = MallUtils.AESEncrypt(string.Format("{0},{1},{2}", partUserInfo.Uid, DateTime.Now, Randoms.CreateRandomValue(6))); string url = string.Format("http://{0}{1}", Request.Url.Authority, Url.Action("resetpwd", new RouteValueDictionary { { "v", v } })); Emails.SendFindPwdEmail(partUserInfo.Email, partUserInfo.UserName, url); return(AjaxResult("success", "邮件已发送,请查收")); }