Exemple #1
0
        //
        // GET: /Ajax/
        public ActionResult UserExistEmail()
        {
            string email = this.Request.Form["param"];

            BLL.DB_User bll_user = new BLL.DB_User();

            bool isHasName = bll_user.ExistsEmail(email);

            if (isHasName)
            {
                this.Response.Write("{ \"info\":\"Email已存在\", \"status\":\"n\" }");
            }
            else
            {
                this.Response.Write("{ \"info\":\"Email已通验证\", \"status\":\"y\" }");
            }

            bll_user.Close();

            return(View());
        }
Exemple #2
0
        //
        // GET: /NLCQ/
        public ActionResult Reg()
        {
            NModel.NewsPager model_pager = LoadConfig("/nlcq/reg");

            string _Captcha         = this.Request.Form["Captcha"];
            string password         = this.Request.Form["password"];
            string isCueLoginStatus = this.Request["isCueLoginStatus"];

            //验证码
            if (!string.IsNullOrEmpty(_Captcha) && !string.IsNullOrEmpty(NModel.EnObject.GetCodeValue + ""))
            {
                if (_Captcha.Equals(NModel.EnObject.GetCodeValue + ""))
                {
                    String JsonStr = "";

                    NModel.DB_User model    = new NModel.DB_User();
                    BLL.DB_User    bll_User = new BLL.DB_User();

                    bool isGet = Tool.NStr.PostForSetVal <NModel.DB_User>(ref model, ref JsonStr, "");

                    bool isUserNameExists = !String.IsNullOrEmpty(model.User_Name) && bll_User.ExistsName(model.User_Name);

                    if (isGet && !isUserNameExists)
                    {
                        bool isUserEmailExists = !String.IsNullOrEmpty(model.User_Email) && bll_User.ExistsEmail(model.User_Email);
                        if (!isUserEmailExists)
                        {
                            if (!string.IsNullOrEmpty(model.User_PW) && !string.IsNullOrEmpty(password))
                            {
                                //密码是否相同
                                if (model.User_PW.Trim().Equals(password.Trim()))
                                {
                                    model.User_PW = NMd5.GetMd5Hash(model.User_PW);
                                    //增加数据
                                    if (bll_User.AddFree(model) > 0)
                                    {
                                        bll_User.CheckLogin(model.User_Name, model.User_PW, _Captcha, true);
                                        Tool.NMsg.AlertAndRedirect("注册成功", "/nlcq/index");
                                    }

                                    //登录

                                    //刷新验证码
                                    NCaptcha.Generate(NModel.EnObject.UserCodeSessionName);
                                }
                            }
                        }
                    }
                    bll_User.Close();
                }
            }

            // if(isGet&&model.)

            return(View(model_pager));
        }