public static bool GetBool(this IDistributedCache distributedCache, string key, bool defaultValue) { var number = distributedCache.GetInt(key); if (number == null) { return(defaultValue); } return(number.Value == 1); }
//public IActionResult Index() //{ // return View(); //} /// <summary> /// 登录 页面 /// </summary> /// <returns></returns> public IActionResult Login() { var number = distributedCache.GetInt(errorCountKey); ViewBag.Title = "请登录"; SetLocale(); ConfigSetting configSetting = new ConfigSetting(); ViewBag.quickLogin = Request.Cookies["token"] != null; ViewBag.ConfigSetting = configSetting; //是否需要验证码服务 if (this.config.SecurityConfig.NeedVerificationCode == NeedVerificationCode.OFF || ((this.config.SecurityConfig.NeedVerificationCode == NeedVerificationCode.AUTO) && number < 10)) { ViewBag.needCaptcha = "false"; } else { ViewBag.needCaptcha = "true"; } ViewBag.errorCount = number; return(View()); }