Exemplo n.º 1
0
        /// <summary>
        /// 修改支付密码
        /// </summary>
        public void SetPayPassword()
        {
            string PWD  = RequestTool.RequestSafeString("Pay_Password");
            string PWD1 = RequestTool.RequestSafeString("Pay_Password1");
            string PWD2 = RequestTool.RequestSafeString("Pay_Password2");

            PWD = EX_User.MD5(PWD);
            if (PWD != CurrentUser.Pay_Password && CurrentUser.Pay_Password != "")
            {
                Response.Write("{\"msg\":\"" + Tag("原始密码错误") + "\"}");
                return;
            }
            else
            {
                Lebi_User_Answer user_answer = B_Lebi_User_Answer.GetModel("User_id= " + CurrentUser.id);
                if (user_answer == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("请先设置安全问题") + "\"}");
                    return;
                }
            }
            CurrentUser.Pay_Password = EX_User.MD5(PWD1);
            B_Lebi_User.Update(CurrentUser);
            Response.Write("{\"msg\":\"OK\"}");
        }
Exemplo n.º 2
0
        /// <summary>
        /// 编辑安全问题
        /// </summary>
        public void Question_Edit()
        {
            if (!EX_Admin.Power("user_edit", "编辑会员"))
            {
                AjaxNoPower();
            }
            int    id           = RequestTool.RequestInt("id", 0);
            int    Question_id1 = RequestTool.RequestInt("Question_id1", 0);
            int    Question_id2 = RequestTool.RequestInt("Question_id2", 0);
            string Answer1      = EX_User.MD5(RequestTool.RequestSafeString("Answer1"));
            string Answer2      = EX_User.MD5(RequestTool.RequestSafeString("Answer2"));

            if (Question_id1 == Question_id2)
            {
                Response.Write("{\"msg\":\"" + Tag("请选择两个不同的问题") + "\"}");
                return;
            }
            if (Answer1 == "" || Answer2 == "")
            {
                Response.Write("{\"msg\":\"" + Tag("请填写问题答案") + "\"}");
                return;
            }
            Lebi_User_Answer model = B_Lebi_User_Answer.GetModel("User_id = " + id + "");

            if (model == null)
            {
                model = new Lebi_User_Answer();
                model.User_Question_id = Question_id1;
                model.Answer           = Answer1;
                model.User_id          = id;
                B_Lebi_User_Answer.Add(model);
                model.User_Question_id = Question_id2;
                model.Answer           = Answer2;
                model.User_id          = id;
                B_Lebi_User_Answer.Add(model);
                Log.Add("添加安全问题", "User_Answer", id.ToString(), CurrentAdmin, id.ToString());
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
Exemplo n.º 3
0
        /// <summary>
        /// 编辑安全问题
        /// </summary>
        public void Question_Edit()
        {
            int    type         = RequestTool.RequestInt("type", 0);
            int    Question_id1 = RequestTool.RequestInt("Question_id1", 0);
            int    Question_id2 = RequestTool.RequestInt("Question_id2", 0);
            string Answer1      = EX_User.MD5(RequestTool.RequestSafeString("Answer1"));
            string Answer2      = EX_User.MD5(RequestTool.RequestSafeString("Answer2"));

            if (Question_id1 == Question_id2)
            {
                Response.Write("{\"msg\":\"" + Tag("请选择两个不同的问题") + "\"}");
                return;
            }
            if (Answer1 == "" || Answer2 == "")
            {
                Response.Write("{\"msg\":\"" + Tag("请填写问题答案") + "\"}");
                return;
            }
            bool             addflag = false;
            Lebi_User_Answer model   = B_Lebi_User_Answer.GetModel("User_id = " + CurrentUser.id + "");

            if (model == null)
            {
                addflag = true;
                model   = new Lebi_User_Answer();
            }
            if (addflag)
            {
                model.User_Question_id = Question_id1;
                model.Answer           = Answer1;
                model.User_id          = CurrentUser.id;
                B_Lebi_User_Answer.Add(model);
                model.User_Question_id = Question_id2;
                model.Answer           = Answer2;
                model.User_id          = CurrentUser.id;
                B_Lebi_User_Answer.Add(model);
            }
            else
            {
                int i = 0;
                List <Lebi_User_Answer> modellists = B_Lebi_User_Answer.GetList("User_id = " + CurrentUser.id + "", "id asc");
                foreach (Lebi_User_Answer modellist in modellists)
                {
                    if (i == 0 && modellist.Answer != Answer1)
                    {
                        Response.Write("{\"msg\":\"" + Tag("问题答案回答不正确") + "\"}");
                        return;
                    }
                    if (i == 1 && modellist.Answer != Answer2)
                    {
                        Response.Write("{\"msg\":\"" + Tag("问题答案回答不正确") + "\"}");
                        return;
                    }
                    i++;
                }
                if (type == 1)
                {
                    CurrentUser.Pay_Password = "";
                    B_Lebi_User.Update(CurrentUser);
                    Response.Write("{\"msg\":\"OK\",\"type\":\"1\",\"url\":\"" + URL("P_UserChangePassword", "") + "\"}");
                    return;
                }
                else
                {
                    B_Lebi_User_Answer.Delete("User_id = " + CurrentUser.id + "");
                }
            }
            Response.Write("{\"msg\":\"OK\",\"type\":\"0\"}");
        }
Exemplo n.º 4
0
        /// <summary>
        /// 忘记密码的处理
        /// </summary>
        public void User_forgetpwd()
        {
            int    type       = RequestTool.RequestInt("type", 0);
            string Email_     = RequestTool.RequestSafeString("Email");
            string UserName   = RequestTool.RequestSafeString("UserName");
            string verifycode = RequestTool.RequestString("verifycode");

            if (SYS.Verifycode_ForgetPassword == "1")
            {
                if (CurrentCheckCode != verifycode)
                {
                    Response.Write("{\"msg\":\"" + Tag("验证码错误") + "\"}");
                    return;
                }
            }
            if (type == 0)
            {
                //发送邮件
                Lebi_User user = B_Lebi_User.GetModel("Email=lbsql{'" + Email_ + "'}");
                if (user == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("用户不存在") + "\"}");
                    return;
                }
                try
                {
                    //发送邮件
                    Email.SendEmail_forgetpwd(user, CurrentTheme);
                    //发送短信
                    SMS.SendSMS_forgetpwd(user);
                }
                catch (Exception ex)
                {
                    Response.Write("{\"msg\":\"" + ex.Message + "\"}");
                }
                Response.Write("{\"msg\":\"OK\"}");
            }
            else if (type == 1)
            {
                Lebi_User user = B_Lebi_User.GetModel("UserName=lbsql{'" + UserName + "'}");
                if (user == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("用户不存在") + "\"}");
                    return;
                }
                Lebi_User_Answer user_answer = B_Lebi_User_Answer.GetModel("User_id= " + user.id);
                if (user_answer == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("未设置安全问题") + "\"}");
                    return;
                }
                BaseConfig conf = ShopCache.GetBaseConfig();
                user.CheckCode = EX_User.MD5(System.DateTime.Now.ToString() + conf.InstallCode);
                B_Lebi_User.Update(user);
                Response.Write("{\"msg\":\"OK\",\"url\":\"" + ThemeUrl.GetURL("P_FindPassword", "", "", user.Language) + "?id=" + user.id + "&v=" + user.CheckCode + "&type=1\"}");
            }
            else if (type == 2)
            {
                Lebi_User user = B_Lebi_User.GetModel("UserName=lbsql{'" + UserName + "'}");
                if (user == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("用户不存在") + "\"}");
                    return;
                }
                if (user.MobilePhone == "")
                {
                    Response.Write("{\"msg\":\"" + Tag("未设置手机号码") + "\"}");
                    return;
                }
                Random Random  = new Random();
                int    RandNum = Random.Next(100000, 999999);
                user.Password = EX_User.MD5(RandNum.ToString());
                B_Lebi_User.Update(user);
                //发送短信
                SMS.SendSMS_newpwd(user, RandNum.ToString());
                Response.Write("{\"msg\":\"OK\",\"url\":\"" + ThemeUrl.GetURL("P_Login", "", "", user.Language) + "\"}");
            }
        }