コード例 #1
0
ファイル: HomeController.cs プロジェクト: sanlonezhang/ql
        public ActionResult AjaxCheckFindPasswordForCustomer(FormCollection form)
        {
            string validatedCode = Request["ValidatedCode"].ToString();

            if (CookieHelper.GetCookie <String>("VerifyCode").ToLower() == validatedCode.ToLower())
            {
                string customerStr = Request["CustomerID"].ToString();
                if (LoginFacade.IsExistCustomer(customerStr))//存在该用户名
                {
                    CustomerInfo customer = CustomerFacade.GetCustomerByID(customerStr);
                    if (string.IsNullOrEmpty(customer.Email))
                    {
                        return(Json("该用户没有绑定邮箱地址", JsonRequestBehavior.AllowGet));
                    }

                    //邮箱是否被验证
                    if (customer.IsEmailConfirmed != 1)
                    {
                        return(Json("对不起,您的邮箱还没有通过验证,请使用其他方式找回密码!", JsonRequestBehavior.AllowGet));
                    }
                    CookieHelper.SaveCookie <string>("FindPasswordCustomerID", customerStr);
                    //string customerid = CookieHelper.GetCookie<String>("FindPasswordCustomerID");
                    string imgBaseUrl = ConfigurationManager.AppSettings["CDNWebDomain"].ToString();//图片根目录
                    string domain     = ConfigurationManager.AppSettings["WebDomain"].ToString();
                    LoginFacade.SendFindPasswordMail(customerStr, imgBaseUrl, domain);
                    string email   = customer.Email;
                    int    x       = email.IndexOf("@");
                    string account = email.Substring(0, x);
                    if (account.Length > 1)
                    {
                        account = account.Substring(1, account.Length - 1);
                    }
                    email = email.Replace(account, "******");
                    return(Json(email, JsonRequestBehavior.AllowGet));
                }
                return(Json("不存在该用户", JsonRequestBehavior.AllowGet));
            }
            return(Json("验证码不正确", JsonRequestBehavior.AllowGet));
        }