示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.UserName = String.Empty;

            if (!SecurityData.IsAuthenticated)
            {
                SecurityData.ResetAuth();
                Response.Redirect(SiteFilename.LogonURL);
            }

            this.UserName = SecurityData.CurrentUserIdentityName;

            if (!SecurityData.IsAdmin)
            {
                tabUserSecurity.Visible = false;
            }

            tabUserAdmin.Visible  = tabUserSecurity.Visible;
            tabGroupAdmin.Visible = tabUserSecurity.Visible;
            tabSites.Visible      = tabUserSecurity.Visible;

            if (SiteData.CurretSiteExists)
            {
                litServerTime.Text = String.Format("{0} {1}", SiteData.CurrentSite.Now, SiteData.CurrentSite.TimeZoneIdentifier);
                litSiteIdent.Text  = SiteData.CurrentSite.SiteName;
                litTag.Text        = SiteData.CurrentSite.SiteTagline;

                if (!String.IsNullOrEmpty(SiteData.CurrentSite.SiteName) && !String.IsNullOrEmpty(SiteData.CurrentSite.SiteTagline))
                {
                    litSiteIdent.Text = String.Format("{0}: ", SiteData.CurrentSite.SiteName.Trim());
                }
            }
            else
            {
                litServerTime.Text = String.Format("{0} UTC", DateTime.UtcNow);
            }

            LoadFooterCtrl(plcFooter, ControlLocation.MainFooter);

            litCMSBuildInfo.Text = SiteData.CarrotCakeCMSVersion;
            litVersion.Text      = SiteData.CarrotCakeCMSVersionMM;

            HideWhenNoSiteProfileExists();
        }
示例#2
0
        protected override void OnInit(EventArgs e)
        {
            if (SecurityData.IsAuthenticated)
            {
                bool bHasAccess = siteHelper.VerifyUserHasSiteAccess(SiteData.CurrentSiteID, SecurityData.CurrentUserGuid);

                if (!bHasAccess)
                {
                    SecurityData.ResetAuth();
                    Response.Redirect(SiteFilename.LogonURL);
                }
            }

            Response.Cache.SetCacheability(System.Web.HttpCacheability.Private);
            DateTime dtExpire = System.DateTime.Now.AddMinutes(-5);

            Response.Cache.SetExpires(dtExpire);

            base.OnInit(e);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            DatabaseUpdate du = new DatabaseUpdate(true);

            if (!String.IsNullOrEmpty(Request.QueryString["signout"]))
            {
                SecurityData.ResetAuth();
            }

            List <DatabaseUpdateMessage> lst = new List <DatabaseUpdateMessage>();

            btnLogin.Visible  = false;
            btnCreate.Visible = false;

            if (DatabaseUpdate.LastSQLError != null)
            {
                du.HandleResponse(lst, DatabaseUpdate.LastSQLError);
                DatabaseUpdate.LastSQLError = null;
            }
            else
            {
                bool bUpdate = true;

                if (!du.DoCMSTablesExist())
                {
                    bUpdate = false;
                }

                bUpdate = du.DatabaseNeedsUpdate();

                if (bUpdate)
                {
                    DatabaseUpdateStatus status = du.PerformUpdates();
                    lst = du.MergeMessages(lst, status.Messages);
                }
                else
                {
                    DataInfo ver = DatabaseUpdate.GetDbSchemaVersion();
                    du.HandleResponse(lst, "Database up-to-date [" + ver.DataValue + "] ");
                }

                bUpdate = du.DatabaseNeedsUpdate();

                if (!bUpdate && DatabaseUpdate.LastSQLError == null)
                {
                    if (DatabaseUpdate.UsersExist)
                    {
                        btnLogin.Visible = true;
                    }
                    else
                    {
                        btnCreate.Visible = true;
                    }
                }
            }

            if (DatabaseUpdate.LastSQLError != null)
            {
                du.HandleResponse(lst, DatabaseUpdate.LastSQLError);
            }

            if (lst.Where(x => !String.IsNullOrEmpty(x.ExceptionText)).Count() > 0)
            {
                bOK = false;
            }
            else
            {
                bOK = true;
            }

            GeneralUtilities.BindRepeater(rpMessages, lst.OrderBy(x => x.Order));

            using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                cmsHelper.ResetConfigs();
            }
        }
示例#4
0
 protected void btnLogout_Click(object sender, EventArgs e)
 {
     SecurityData.ResetAuth();
     Response.Redirect(SiteFilename.LogonURL);
 }