예제 #1
0
        public ActionResult Access(AccessModel model)
        {
            if (ModelState.IsValid)
            {
                MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

                mallConfigInfo.IsClosed = model.IsClosed;
                mallConfigInfo.CloseReason = model.CloseReason == null ? "" : model.CloseReason;
                mallConfigInfo.BanAccessTime = model.BanAccessTime == null ? "" : model.BanAccessTime;
                mallConfigInfo.BanAccessIP = model.BanAccessIP == null ? "" : model.BanAccessIP;
                mallConfigInfo.AllowAccessIP = model.AllowAccessIP == null ? "" : model.AllowAccessIP;
                mallConfigInfo.AdminAllowAccessIP = model.AdminAllowAccessIP == null ? "" : model.AdminAllowAccessIP;
                mallConfigInfo.SecretKey = model.SecretKey;
                mallConfigInfo.CookieDomain = model.CookieDomain == null ? "" : model.CookieDomain.Trim('.');
                mallConfigInfo.RandomLibrary = model.RandomLibrary == null ? "" : model.RandomLibrary;
                mallConfigInfo.VerifyPages = CommonHelper.StringArrayToString(model.VerifyPages);
                mallConfigInfo.IgnoreWords = model.IgnoreWords == null ? "" : model.IgnoreWords;
                mallConfigInfo.AllowEmailProvider = model.AllowEmailProvider == null ? "" : model.AllowEmailProvider;
                mallConfigInfo.BanEmailProvider = model.BanEmailProvider == null ? "" : model.BanEmailProvider;

                BMAConfig.SaveMallConfig(mallConfigInfo);
                Emails.ResetMall();
                SMSes.ResetMall();
                Randoms.ResetRandomLibrary();
                FilterWords.ResetIgnoreWordsRegex();
                AddMallAdminLog("修改访问控制");
                return PromptView(Url.Action("access"), "修改访问控制成功");
            }

            ViewData["verifyPages"] = CommonHelper.StringArrayToString(model.VerifyPages);
            return View(model);
        }
예제 #2
0
        public ActionResult Access()
        {
            MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

            AccessModel model = new AccessModel();
            model.IsClosed = mallConfigInfo.IsClosed;
            model.CloseReason = mallConfigInfo.CloseReason;
            model.BanAccessTime = mallConfigInfo.BanAccessTime;
            model.BanAccessIP = mallConfigInfo.BanAccessIP;
            model.AllowAccessIP = mallConfigInfo.AllowAccessIP;
            model.AdminAllowAccessIP = mallConfigInfo.AdminAllowAccessIP;
            model.SecretKey = mallConfigInfo.SecretKey;
            model.CookieDomain = mallConfigInfo.CookieDomain;
            model.RandomLibrary = mallConfigInfo.RandomLibrary;
            model.VerifyPages = StringHelper.SplitString(mallConfigInfo.VerifyPages);
            model.IgnoreWords = mallConfigInfo.IgnoreWords;
            model.AllowEmailProvider = mallConfigInfo.AllowEmailProvider;
            model.BanEmailProvider = mallConfigInfo.BanEmailProvider;

            ViewData["verifyPages"] = mallConfigInfo.VerifyPages;
            return View(model);
        }