예제 #1
0
        public override void Page_Load(ref NVelocity.VelocityContext context)
        {
            base.Page_Load(ref context);

            #region  加载头部及Title
            NewXzc.Web.templatecs.Head head = new Head();
            head.Init_Head(context, 0);

            context.Put("title", "找回密码_女装搭配|衣品搭配");
            #endregion

            int uid = CheckIsLogin_HongRenHui.GetUserID("FINDRED_HREN_USERID");

            if (uid <= 0)
            {
                context.Put("redirecturl", "/findpwd");
            }
            else
            {
                context.Put("codes", String_Manage.Return_Request_Str("code"));

                string tel = new BLL.RED_USER().GetModel(uid).TEL;

                //tel = tel.Substring(0, 3) + "****" + tel.Substring(7, 4);

                context.Put("tel", tel);
            }
        }
예제 #2
0
        public override void Page_Load(ref NVelocity.VelocityContext context)
        {
            base.Page_Load(ref context);

            #region  加载头部及Title
            NewXzc.Web.templatecs.Head head = new Head();
            head.Init_Head(context, 0);

            context.Put("title", "找回密码_女装搭配|衣品搭配");
            #endregion

            if (CheckIsLogin_HongRenHui.GetUserID("FINDRED_HREN_USERID") <= 0 || CookieManage_HongRenHui.GetCookieValue("FINDTEL_HREN_STATE") != "1")
            {
                context.Put("redirecturl", "/findpwd");
            }
        }
예제 #3
0
        private void Update_User_Pwd(HttpContext context)
        {
            string result = "ok";

            int uid = CheckIsLogin_HongRenHui.GetUserID("FINDRED_HREN_USERID");

            string phone = "";

            user_model = user_bll.GetModel(uid);

            if (user_model != null)
            {
                if (CookieManage_HongRenHui.GetCookieValue("FINDTEL_HREN_STATE") != "1")
                {
                    result = "notel";
                }
                else
                {
                    string pwd = String_Manage.Return_Request_Str("pwd");
                    if (pwd == "")
                    {
                        result = "nopwd";
                    }
                    else
                    {
                        pwd            = NewXzc.Common.DEncrypt.DESEncrypt.Encrypt(pwd);//给密码加密
                        user_model.PWD = pwd;

                        if (!user_bll.Update(user_model, 2))
                        {
                            result = "no";
                        }
                    }
                }
            }
            else
            {
                result = "nologin";
            }

            context.Response.Write(result);
        }
예제 #4
0
        private void VerifyCodeIsExists(HttpContext context)
        {
            int uid = CheckIsLogin_HongRenHui.GetUserID("FINDRED_HREN_USERID");

            string phone = "";

            user_model = user_bll.GetModel(uid);

            if (user_model != null)
            {
                phone = user_model.TEL;
            }

            if (phone != "")
            {
                try
                {
                    string verifycode = context.Request["Vc"];

                    string phone2 = "", verifycode2 = "";

                    string[] items = null;

                    if (HttpContext.Current.Session["PhoneVerifyCode"] != null)
                    {
                        string PhoneVerifyCode = "";
                        PhoneVerifyCode = HttpContext.Current.Session["PhoneVerifyCode"].ToString();

                        if (PhoneVerifyCode.IndexOf(',') != -1)//有多个手机号和验证码,因为短信有可能延迟用户就会收到多个验证码,应该保证每个验证码是正确的。
                        {
                            items = PhoneVerifyCode.Split(',');
                        }
                        else
                        {
                            items    = new string[1];
                            items[0] = PhoneVerifyCode;
                        }
                    }

                    bool isOk = false;

                    for (int i = 0; i < items.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(items[i]))
                        {
                            phone2      = items[i].Split('-')[1];
                            verifycode2 = items[i].Split('-')[0];

                            if (phone == phone2 && verifycode == verifycode2)
                            {
                                isOk = true;
                                break;
                            }
                        }
                    }

                    if (isOk)
                    {
                        CookieManage_HongRenHui.AddCookie("FINDTEL_HREN_STATE", "1", 1, false);
                        context.Response.Write("1");
                    }
                    else
                    {
                        context.Response.Write("0");
                    }
                }
                catch (Exception ex)
                {
                    context.Response.Write("0");
                }
            }
            else
            {
                context.Response.Write("nologin");
            }
            context.Response.End();
        }
예제 #5
0
        private void SendPhoneVerifyCode(HttpContext context)
        {
            int uid = CheckIsLogin_HongRenHui.GetUserID("FINDRED_HREN_USERID");

            string phone = "";

            user_model = user_bll.GetModel(uid);

            if (user_model != null)
            {
                phone = user_model.TEL;
            }

            if (phone != "")
            {
                Random rd   = new Random();
                string code = rd.Next(100000, 999999).ToString();



                //前台生成的验证码,用于点击发送验证码前验证用
                string send_code_yzm = String_Manage.Return_Request_Str("send_code_yzm");

                if (send_code_yzm != "")
                {
                    try
                    {
                        if (HttpContext.Current.Session["code"] != null)
                        {
                            if (!string.IsNullOrEmpty(HttpContext.Current.Session["code"].ToString()))
                            {
                                string str_yzm = HttpContext.Current.Session["code"].ToString();
                                if (send_code_yzm != str_yzm)
                                {
                                    context.Response.Write("error_yzm");
                                }
                                else
                                {
                                    try
                                    {
                                        if (HttpContext.Current.Session["PhoneVerifyCode"] == null)
                                        {
                                            HttpContext.Current.Session["PhoneVerifyCode"] = code + "-" + phone;
                                        }
                                        else
                                        {
                                            if (string.IsNullOrEmpty(HttpContext.Current.Session["PhoneVerifyCode"].ToString()))
                                            {
                                                HttpContext.Current.Session["PhoneVerifyCode"] = code + "-" + phone;
                                            }
                                            else
                                            {
                                                string strSess = HttpContext.Current.Session["PhoneVerifyCode"].ToString();
                                                HttpContext.Current.Session["PhoneVerifyCode"] = strSess + "," + code + "-" + phone;
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        HttpContext.Current.Session["PhoneVerifyCode"] = code + "-" + phone;
                                    }
                                    finally
                                    {
                                        //判断当前用户是否已经绑定过手机
                                        #region  发送短信
                                        string shortMessageWord = "衣品搭配密码找回验证码:" + code + ",牢记密码,小主记得常来哦。";
                                        string result           = Send_Short_Message.Send_Message_Short(shortMessageWord, phone);
                                        //string result = "ok";
                                        //result = result + code;

                                        context.Response.Write(result);
                                        #endregion
                                    }
                                }
                            }
                            else
                            {
                                context.Response.Write("noyzm");
                            }
                        }
                        else
                        {
                            context.Response.Write("noyzm");
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                else
                {
                    context.Response.Write("noyzm");
                }
            }
            else
            {
                context.Response.Write("nologin");
            }
        }