private void logIn(bool hideWarnings) { NonLiveInstallationStatics.SetIntermediateAuthenticationCookie(); AppRequestState.Instance.IntermediateUserExists = true; if (hideWarnings) { NonLiveInstallationStatics.SetWarningsHiddenCookie(); } }
void ControlTreeDataLoader.LoadData() { basicBody.Attributes.Add("onpagehide", "deactivateProcessingDialog();"); form.Action = EwfPage.Instance.InfoAsBaseType.GetUrl(); ph.AddControlsReturnThis( new NamingPlaceholder( EwfPage.Instance.StatusMessages.Any() && statusMessagesDisplayAsNotification() ? new Block { CssClass = notificationSpacerClass }.ToCollection() : Enumerable.Empty <Control>())); var warningLines = new List <IReadOnlyCollection <PhrasingComponent> >(); if (!ConfigurationStatics.IsLiveInstallation) { var components = new List <PhrasingComponent>(); components.Add(new FontAwesomeIcon("fa-exclamation-triangle", "fa-lg")); components.AddRange(" This is not the live system. Changes made here will be lost and are not recoverable. ".ToComponents()); if (ConfigurationStatics.IsIntermediateInstallation && AppRequestState.Instance.IntermediateUserExists) { components.AddRange( new EwfButton( new StandardButtonStyle("Log out", buttonSize: ButtonSize.ShrinkWrap), behavior: new PostBackBehavior( postBack: PostBack.CreateFull( id: "ewfIntermediateLogOut", firstModificationMethod: NonLiveInstallationStatics.ClearIntermediateAuthenticationCookie, actionGetter: () => new PostBackAction(new ExternalResourceInfo(NetTools.HomeUrl))))).Concat(" ".ToComponents())); } components.Add( new EwfButton( new StandardButtonStyle( "Hide this warning", buttonSize: ButtonSize.ShrinkWrap, icon: new ActionComponentIcon(new FontAwesomeIcon("fa-eye-slash"))), behavior: new PostBackBehavior( postBack: PostBack.CreateIntermediate( null, id: "ewfHideNonLiveWarnings", firstModificationMethod: NonLiveInstallationStatics.SetWarningsHiddenCookie)))); if (ConfigurationStatics.IsIntermediateInstallation && AppRequestState.Instance.IntermediateUserExists) { var boxId = new ModalBoxId(); components.AddRange( " ".ToComponents() .Append( new EwfButton( new StandardButtonStyle("Get link", buttonSize: ButtonSize.ShrinkWrap, icon: new ActionComponentIcon(new FontAwesomeIcon("fa-link"))), behavior: new OpenModalBehavior( boxId, etherealChildren: new ModalBox( boxId, true, FormItemList.CreateGrid( 1, items: new[] { false, true }.Select( i => { var url = AppRequestState.Instance.Url; if (AppRequestState.Instance.UserAccessible && AppRequestState.Instance.ImpersonatorExists) { url = SelectUser.GetInfo( url, optionalParameterPackage: new SelectUser.OptionalParameterPackage { User = AppTools.User.Email }) .GetUrl(); } url = IntermediateLogIn.GetInfo( url, new IntermediateLogIn.OptionalParameterPackage { Password = ConfigurationStatics.SystemGeneralProvider.IntermediateLogInPassword, HideWarnings = i }) .GetUrl(); return(new GenericPhrasingContainer( url.ToComponents(), classes: new ElementClass("ewfIntermediateUrl" /* This is used by EWF CSS files. */)).ToFormItem( label: i ? "Non-live warnings hidden:".ToComponents() : "Standard:".ToComponents())); }) .Materialize()) .ToCollection()).ToCollection())))); } warningLines.Add(components); } if (AppRequestState.Instance.UserAccessible && AppRequestState.Instance.ImpersonatorExists && (!ConfigurationStatics.IsIntermediateInstallation || AppRequestState.Instance.IntermediateUserExists)) { warningLines.Add( "User impersonation is in effect. ".ToComponents() .Append( new EwfHyperlink( SelectUser.GetInfo(AppRequestState.Instance.Url), new ButtonHyperlinkStyle("Change user", buttonSize: ButtonSize.ShrinkWrap))) .Concat(" ".ToComponents()) .Append( new EwfButton( new StandardButtonStyle("End impersonation", buttonSize: ButtonSize.ShrinkWrap), behavior: new PostBackBehavior( postBack: PostBack.CreateFull( id: "ewfEndImpersonation", firstModificationMethod: UserImpersonationStatics.EndImpersonation, actionGetter: () => new PostBackAction(new ExternalResourceInfo(NetTools.HomeUrl)))))) .Materialize()); } if (warningLines.Any()) { ph.AddControlsReturnThis( new GenericFlowContainer( warningLines.Aggregate((components, line) => components.Append(new LineBreak()).Concat(line).Materialize()), displaySetup: new DisplaySetup(ConfigurationStatics.IsLiveInstallation || !NonLiveInstallationStatics.WarningsHiddenCookieExists()), classes: topWarningContainerClass).ToCollection() .GetControls()); } // This is used by the EWF JavaScript file. const string clickBlockerId = "ewfClickBlocker"; ph2.AddControlsReturnThis( new Block { ClientIDMode = ClientIDMode.Static, ID = clickBlockerId, CssClass = clickBlockerInactiveClass }, new PlaceHolder().AddControlsReturnThis(getProcessingDialog().GetControls()), new NamingPlaceholder(getStatusMessageControl())); }