/// <summary>
 /// 更改商店会员帐号密码
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnChange_Click(object sender, EventArgs e)
 {
     SiteInfo.ShopLoginName = "";
     SiteInfo.ShopPassword  = "";
     SiteConfigs.SaveConfig(SiteInfo);
     ShowRegistePanl(true);
 }
Exemple #2
0
        private void SaveToConfigFile()
        {
            SiteConfigInfo si = SiteConfigs.GetConfig();

            if (!string.IsNullOrEmpty(SEUrlTextBox.Text))
            {
                si.FullTextSearchUrl = SEUrlTextBox.Text;
                SiteConfigs.SaveConfig(si);
            }

            string url = "tcp://localhost:11001";

            if (!string.IsNullOrEmpty(si.FullTextSearchUrl))
            {
                url = si.FullTextSearchUrl;
            }

            ISearchService searcher = Activator.GetObject(typeof(ISearchService), url + "/SearchService") as ISearchService;

            if (searcher != null)
            {
                SiteInfo site = new SiteInfo(si.SiteID, si.SiteName, si.RootUrl);
                searcher.RegisterSite(site);
                Messages.ShowMessage("站点已成功注册到搜索服务器!");
            }
        }
Exemple #3
0
        // Token: 0x06000264 RID: 612 RVA: 0x00007EE0 File Offset: 0x000060E0
        public static bool CreateSite(string sitepath, out string errormsg)
        {
            errormsg = "";
            string pattern = "^[a-zA-Z0-9_\\w]+$";
            bool   result;

            if (!Regex.IsMatch(sitepath, pattern, RegexOptions.IgnoreCase))
            {
                errormsg = "模板路径只能由数字、字母、下划线组成,并且首字不能为数字。";
                result   = false;
            }
            else
            {
                string mapPath = FPUtils.GetMapPath(WebConfig.WebPath + "sites/" + sitepath);
                if (!Directory.Exists(mapPath))
                {
                    errormsg = "错误:该站点“" + sitepath + "”已被删除或不存在。";
                    result   = false;
                }
                else
                {
                    string     mapPath2 = FPUtils.GetMapPath(WebConfig.WebPath + sitepath);
                    SiteConfig siteInfo = SiteConfigs.GetSiteInfo(sitepath);
                    SiteBll.CreateViewFile(siteInfo, sitepath);
                    siteInfo.iscompile = 1;
                    SiteConfigs.SaveConfig(siteInfo, mapPath2 + "\\site.config");
                    result = true;
                }
            }
            return(result);
        }
Exemple #4
0
        void changePassword(string loginName, string password, string newPassword)
        {
            if (AccountID == We7Helper.EmptyGUID && String.Compare(loginName, SiteConfigs.GetConfig().AdministratorName, true) == 0)
            {
                if (CDHelper.AdminPasswordIsValid(password))
                {
                    SiteConfigInfo si       = SiteConfigs.GetConfig();
                    bool           isHashed = si.IsPasswordHashed;
                    if (isHashed != IsHashedPasswordCheckBox.Checked)
                    {
                        si.IsPasswordHashed = IsHashedPasswordCheckBox.Checked;
                    }
                    if (IsHashedPasswordCheckBox.Checked)
                    {
                        si.AdministratorKey = Security.Encrypt(newPassword);
                    }
                    else
                    {
                        si.AdministratorKey = newPassword;
                    }

                    SiteConfigs.SaveConfig(si);
                    //CDHelper.UpdateSystemInformation(si);

                    ShowMessage("您的密码已修改成功。");
                }
                else
                {
                    ShowMessage("对不起,您输入的旧密码不正确!");
                }
            }
            else
            {
                Account act = AccountHelper.GetAccountByLoginName(loginName);
                if (act == null)
                {
                    ShowMessage("指定的用户不存在。");
                }
                else if (!AccountHelper.IsValidPassword(act, password))
                {
                    ShowMessage("对不起,您输入的旧密码不正确!");
                }
                else if (act.State != 1)
                {
                    ShowMessage("该帐户不可用。");
                }
                else
                {
                    act.IsPasswordHashed = IsHashedPasswordCheckBox.Checked;
                    AccountHelper.UpdatePassword(act, newPassword);

                    //记录日志
                    string content = string.Format("修改了“{0}”的密码", act.LoginName);
                    AddLog("修改密码", content);

                    ShowMessage("您的密码已修改成功。");
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// 通过Email发送密码信息
        /// </summary>
        /// <param name="account">权限信息</param>
        /// <param name="AccountHelper">权限业务对象</param>
        /// <returns></returns>
        public string SendPasswordByMail(Account account, IAccountHelper AccountHelper)
        {
            GeneralConfigInfo si = Config;

            if (si.SystemMail == "" || si.SysMailUser == "" || si.SysMailServer == "")
            {
                return("系统邮件信息不全,请到网站菜单“系统设置”中设置相关参数。");
            }
            else
            {
                MailHelper mailHelper = new MailHelper();
                mailHelper.AdminEmail = si.SystemMail;
                mailHelper.UserName   = si.SysMailUser;
                mailHelper.Password   = si.SysMailPassword;
                mailHelper.SmtpServer = si.SysMailServer;

                string password = null;
                if (account.IsPasswordHashed)
                {
                    password = Security.ResetPassword(account);

                    string secuPassword = "";
                    if (account.PasswordHashed == (int)We7.CMS.Common.Enum.TypeOfPasswordHashed.webEncrypt)
                    {
                        secuPassword = Security.Encrypt(password);
                    }
                    else if (account.PasswordHashed == (int)We7.CMS.Common.Enum.TypeOfPasswordHashed.bbsEncrypt)
                    {
                        secuPassword = Security.BbsEncrypt(password);
                    }
                    if (String.Compare(account.LoginName, SiteConfigs.GetConfig().AdministratorName, true) == 0)
                    {
                        //UpdateSystemParameter("CD.AdministratorKey", secuPassword);
                        SiteConfig.AdministratorKey = secuPassword;
                        SiteConfigs.SaveConfig(SiteConfig);
                    }
                    else
                    {
                        AccountHelper.UpdatePassword(account, secuPassword);
                    }
                }
                else
                {
                    password = account.Password;
                }

                string message = "亲爱的{0},您好:\r\n您的登录帐户:\r\n用户名: {3}\r\n密码: {1}\r\n\r\n{5}-{2}\r\n网站管理员\r\n{4}";

                string mainurl = SiteConfig.RootUrl;
                string To      = account.Email;
                string From    = string.Format("\"{1}系统邮件\" <{0}>", si.SystemMail, SiteConfig.SiteName);
                string Subject = "您的网站登录信息";
                string Body    = string.Format(message, account.LastName, password, mainurl, account.LoginName, DateTime.Now.ToLongDateString(), SiteConfig.SiteName);
                mailHelper.Send(To, From, Subject, Body, "");
                //Message.Text = "Login Credentials Sent<br>";
                return("新密码已发至你的邮箱");
            }
        }
Exemple #6
0
        // Token: 0x06000263 RID: 611 RVA: 0x00007E8C File Offset: 0x0000608C
        public static bool SaveSiteConfig(SiteConfig siteconfig)
        {
            string mapPath = FPUtils.GetMapPath(WebConfig.WebPath + "sites/" + siteconfig.sitepath);

            if (!Directory.Exists(mapPath))
            {
                Directory.CreateDirectory(mapPath);
            }
            return(SiteConfigs.SaveConfig(siteconfig, mapPath + "\\site.config"));
        }
Exemple #7
0
 public bool BindShopLoginName(string shopLoginName, string shopPassword, string siteLoginName, string sitePassword)
 {
     try
     {
         if (CheckAdmin(siteLoginName, sitePassword))
         {
             SiteConfigInfo si = SiteConfigs.GetConfig();
             si.ShopLoginName = shopLoginName;
             si.ShopPassword  = shopPassword;
             SiteConfigs.SaveConfig(si);
             return(true);
         }
     }
     catch
     {
     }
     return(false);
 }
        protected void bttnSave_Click(object sender, EventArgs e)
        {
            string name = txtLoginName.Text.Trim();
            string pwd  = txtPassword.Text.Trim();

            if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(name.Trim()))
            {
                Messages.ShowError("会员名不能为空");
                return;
            }
            if (String.IsNullOrEmpty(pwd) || String.IsNullOrEmpty(pwd.Trim()))
            {
                Messages.ShowError("密码不能为空");
                return;
            }

            try
            {
                string[] result = ShopService.RegisteSite(name, pwd, SiteInfo.SiteUrl, SiteInfo.SiteName);
                if (result != null && result.Length >= 1)
                {
                    if (result[0] == "1")
                    {
                        SiteInfo.ShopLoginName = name;
                        SiteInfo.ShopPassword  = ShopService.EncryptPassword(name, pwd);
                        SiteConfigs.SaveConfig(SiteInfo);
                        ShowRegistePanl(false);
                    }
                    else
                    {
                        Messages.ShowError(result.Length > 1 ? result[1] : "注册失败!");
                    }
                }
                else
                {
                    throw new Exception("应用程序执行结果有误!");
                }
            }
            catch (Exception ex)
            {
                Messages.ShowError("应用程序程序!错误原因:" + ex.Message);
            }
        }
Exemple #9
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            SiteConfigInfo ci = SiteConfigs.GetConfig();

            ci.SiteID                = SiteIDTextBox.Text;
            ci.WebGroupServiceUrl    = WDUrlTextBox.Text;
            ci.InformationServiceUrl = IDUrlTextBox.Text;
            ci.PassportServiceUrl    = PassportServiceUrlTextBox.Text;
            ci.SiteGroupEnabled      = SiteGroupEnabledCheckBox.Checked;
            if (WDWebUrlTextBox.Text.EndsWith("/"))
            {
                WDWebUrlTextBox.Text = WDWebUrlTextBox.Text.Remove(WDWebUrlTextBox.Text.Length - 1);
            }
            ci.WDWebUrl = WDWebUrlTextBox.Text;
            SiteConfigs.SaveConfig(ci);

            //记录日志
            string content = string.Format("更改站群配置信息。");

            AddLog("设置-站群参数", content);

            Messages.ShowMessage("站群设置保存成功!");
        }
Exemple #10
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (AppCtx.IsDemoSite)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "aler", "alert('演示站点,不能修改选项!');", true);
                return;
            }

            SiteConfigInfo    ci = SiteConfigs.GetConfig();
            GeneralConfigInfo si = GeneralConfigs.GetConfig();

            ci.SiteName         = SiteNameTextBox.Text;
            si.SiteTitle        = SiteNameTextBox.Text;
            ci.RootUrl          = RootUrlTextBox.Text;
            ci.IsPasswordHashed = IsHashedPasswordCheckBox.Checked;
            ci.ADUrl            = ADUrlTextBox.Text.Trim();
            ci.PluginSN         = txtSN.Text.Trim();
            si.SiteFullName     = txtSiteFullName.Text;
            si.SiteLogo         = ImageValue.Text;
            si.IcpInfo          = txtIcpInfo.Text;

            si.AllowSignup = AllowSignupCheckBox.Checked ? "True" : "False";
            //si.DefaultTemplateGroup = DefaultTemplateGroupTextBox.Text;
            si.DefaultTemplateGroupFileName = DefaultTemplateGroupFileNameTextBox.Text;
            si.DefaultHomePageTitle         = HomePageTitleTextBox.Text;
            si.DefaultChannelPageTitle      = ChannelPageTitleTextBox.Text;
            si.DefaultContentPageTitle      = ContentPageTitleTextBox.Text;

            si.DescriptionPageMeta = DescriptionPageMetaTextBox.Text;
            si.KeywordPageMeta     = KeywordPageMetaTextBox.Text;

            si.NotifyMail = NotifyMailTextBox.Text;

            si.SysMailUser           = SySMailUserTextBox.Text;
            si.SysMailPassword       = SysMailPassTextBox.Text;
            si.SysMailServer         = SysMailServerTextBox.Text;
            si.SystemMail            = SystemMailTextBox.Text;
            si.GenericUserManageType = GenericUserManageTextBox.Text;
            si.SysPopServer          = SysPopServerTextBox.Text;

            si.IsAddLog       = IsAddLogCheckBox.Checked;
            si.IsAuditComment = IsAuditCommentCheckBox.Checked;

            si.UrlFormat           = (AshxRadioButton.Checked) ? "aspx" : "html";
            si.UrlRewriterProvider = (IISRadioButton.Checked) ? "iis" : "asp.net";
            if (ArticleUrlGeneratorDropDownList.SelectedIndex == 3)
            {
                si.ArticleUrlGenerator = ArticleUrlGeneratorTextBox.Text;
            }
            else
            {
                si.ArticleUrlGenerator = ArticleUrlGeneratorDropDownList.SelectedValue;
            }

            si.ArticleAutoShare     = (ArticleAutoShare.Checked) ? "true" : "false";
            si.EnableLoginAuhenCode = (EnableLoginAuhenCodeCheckBox.Checked) ? "true" : "false";

            si.ArticleAutoPublish = (ArticleAutoPublish.Checked) ? "true" : "false";

            si.ArticleSourceDefault = ArticleSourceDefaultTextBox.Text;
            si.EnableCache          = (EnableCache.Checked) ? "true" : "false";
            if (EnableCache.Checked)
            {
                string tmpStr = CacheTimeSpanTextBox.Text;
                Int16  tmpInt = 60;
                if (Int16.TryParse(tmpStr, out tmpInt))
                {
                    si.CacheTimeSpan = tmpInt;
                }
            }

            si.OnlyLoginUserCanVisit = OnlyLoginUserCanVisitCheckBox.Checked;
            si.StartTemplateMap      = StartTemplateMapCheckbox.Checked;
            si.SiteBuildState        = SiteStateDropDownList.SelectedValue;
            si.IPStrategy            = hddnIPStrategy.Value.Trim();
            si.AllowParentArticle    = AllowParentArticleCheckBox.Checked;
            si.EnableSingleTable     = EnableSingleTable.Checked;
            si.DefaultTemplateEditor = UseVisualTemplateCheckBox.Checked ? "1" : "0";
            si.EnableHtmlTemplate    = EnableHtmlTemplate.Checked;
            txtSSOUrls.Text          = si.SSOSiteUrls = Regex.Replace(txtSSOUrls.Text, @"\s", "");
            si.Links     = txtLinks.Text.Trim();
            si.Copyright = txtCopyright.Text.Trim();

            //用户注册验证模式
            si.UserRegisterMode = drpUserRegiseterMode.SelectedValue;

            ipstrategy.Attributes["src"] = "SystemStrategy.aspx?ipstrategy=" + si.IPStrategy;

            SiteConfigs.SaveConfig(ci);
            GeneralConfigs.SaveConfig(si);

            //记录日志
            string content = string.Format("更改站点信息。");

            AddLog("站点概要", content);

            Messages.ShowMessage("系统设置保存成功!");
        }
Exemple #11
0
        /// <summary>
        /// 站点参数从数据库迁移到config文件
        /// </summary>
        public bool MigrateConfig()
        {
            SiteConfigInfo    sconfig = new SiteConfigInfo();
            GeneralConfigInfo gconfig = GeneralConfigs.GetConfig();

            if (gconfig == null)
            {
                HttpContext Context    = HttpContext.Current;
                string      configFile = Context.Server.MapPath("~/Config/general.config");
                gconfig = new GeneralConfigInfo();
                GeneralConfigs.Serialiaze(gconfig, configFile);
            }
            SystemInformation si = GetSystemInformation();

            sconfig.AdministratorID = si.AdministratorID;
            if (si.AdministratorKey != null && si.AdministratorKey != "")
            {
                sconfig.AdministratorKey = si.AdministratorKey;
            }
            if (si.CompanyName != null && si.CompanyName != "")
            {
                sconfig.SiteName = si.CompanyName;
            }
            sconfig.SiteDescription       = si.CompangDescription;
            sconfig.InformationServiceUrl = si.InformationServiceUrl;
            gconfig.ProductName           = si.ProductName;
            //gconfig.ProductVersion = si.ProdcutVersion;
            sconfig.WebGroupServiceUrl = si.WebGroupServiceUrl;
            sconfig.SiteID             = si.SiteID;
            sconfig.RootUrl            = si.RootUrl;
            sconfig.SsoUrl             = si.SsoUrl;
            sconfig.SsoServername      = si.SsoServername;
            sconfig.SsoUsername        = si.SsoUsername;
            sconfig.SsoPassword        = si.SsoPassword;
            sconfig.SsoDomain          = si.SsoDomain;
            sconfig.SsoWdID            = si.SsoWdID;
            sconfig.ADUrl            = si.ADUrl;
            sconfig.IsPasswordHashed = si.IsPasswordHashed;

            gconfig.ArticleAutoPublish           = si.ArticleAutoPublish;
            gconfig.ArticleAutoShare             = si.ArticleAutoShare;
            gconfig.AllCutCheckBox               = si.AllCutCheckBox;
            gconfig.AllowSignup                  = si.AllowSignup;
            gconfig.DefaultTemplateGroup         = si.DefaultTemplateGroup;
            gconfig.DefaultTemplateGroupFileName = si.DefaultTemplateGroupFileName;
            gconfig.DefaultHomePageTitle         = si.DefaultHomePageTitle;
            gconfig.DefaultChannelPageTitle      = si.DefaultChannelPageTitle;
            gconfig.DefaultContentPageTitle      = si.DefaultContentPageTitle;

            gconfig.SystemMail            = si.SystemMail;
            gconfig.SysMailUser           = si.SysMailUser;
            gconfig.SysMailServer         = si.SysMailServer;
            gconfig.SysMailPassword       = si.SysMailPassword;
            gconfig.NotifyMail            = si.NotifyMail;
            gconfig.GenericUserManageType = si.GenericUserManageType;

            gconfig.IsAddLog              = si.IsAddLog;
            gconfig.IsAuditComment        = si.IsAuditComment;
            gconfig.EnableLoginAuhenCode  = si.EnableLoginAuhenCode;
            gconfig.EnableSiteSkins       = si.EnableSiteSkins;
            gconfig.TemplateBasePath      = si.TemplateBasePath;
            gconfig.TemplateGroupBasePath = si.TemplateGroupBasePath;
            gconfig.SiteSkinsBasePath     = si.SiteSkinsBasePath;
            gconfig.ArticleUrlGenerator   = si.ArticleUrlGenerator;
            gconfig.KeywordPageMeta       = si.KeywordPageMeta;
            gconfig.DescriptionPageMeta   = si.DescriptionPageMeta;
            gconfig.CMSTheme              = si.CMSTheme;
            gconfig.DefaultPersonRole     = si.DefaultPersonRole;
            gconfig.DefaultCompanyRole    = si.DefaultCompanyRole;
            gconfig.ArticleSourceDefault  = si.ArticleSourceDefault;
            gconfig.EnableCache           = si.EnableCache;

            return(SiteConfigs.SaveConfig(sconfig) && GeneralConfigs.SaveConfig(gconfig));
        }