public FileResult GetValidCode()
        {
            var code = ValidCodeHelper.CreateValidateCode(6);

            //Session[Keys.ValidCode] = code;
            TempData[Keys.ValidCode] = code;
            byte[] buffer = ValidCodeHelper.CreateValidateGraphic(code);//把验证码画到画布
            return(File(buffer, "image/jpeg"));
        }
示例#2
0
        //
        // GET: /Search/

        public ActionResult GetValidateCode()
        {
            ValidCodeHelper vCode = new ValidCodeHelper();
            string          code  = vCode.CreateValidateCode(4);

            Session["ValidateCode"] = code;
            byte[] bytes = vCode.CreateValidateGraphic(code);

            return(File(bytes, @"image/jpeg"));
        }
示例#3
0
        public int getvalidmobile(string mobile, string validcode = "jk")
        {
            int revalue = 0;

            if (SessionHelper.ValidCode(validcode))
            {
                SessionHelper.userisvalidcode = true;
                ValidCodeHelper vCode = new ValidCodeHelper();
                string          code  = vCode.CreateValidateCode(5);
                SessionHelper.uservalidmobile = code;
                new SmsService().SendCode(mobile, code);
                revalue = 1;
            }
            return(revalue);
        }
示例#4
0
        public ActionResult ForGotPassWord(ForgetPassModel model)
        {
            if (ModelState.IsValid)
            {
                AccountServices service = new AccountServices();
                var             info    = service.Get(m => m.UserName == model.UserName && m.Tel == model.Tel);
                if (info == null)
                {
                    ModelState.AddModelError("UserName", "用户名或手机号错误,请确认");
                }
                else
                {
                    ValidCodeHelper vCode   = new ValidCodeHelper();
                    string          code    = vCode.CreateValidateCode(6);
                    var             tempass = EncryptHelper.Lower32(code);
                    info.Password = tempass;
                    service.UpdatePassword(info.Id, tempass);
                    new SmsService().SendCode(model.Tel, code);
                    return(Redirect("/Account/Temp"));
                }
            }

            return(View());
        }