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")); }
public IActionResult GetValidCode() { string res = ""; string code = ValidCodeHelper.CreateVerifyCode(out res); TempData[ConstList.LOGINSESSION] = res; Stream stream = ImageFactory.BuildImage(code, 40, 120, 12, 2, ImageFormatType.Jpeg); return(File(stream, "image/jpeg")); }
// // 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")); }
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); }
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()); }