public bool AddUser(EventItem eventItem, User user) { var removedState = AnalyticsHelper.GetState("Deregistered", Sitecore.Data.ID.Parse(eventItem.PlanId)); var signupState = AnalyticsHelper.GetState("Registered", Sitecore.Data.ID.Parse(eventItem.PlanId)); var stateVisistors = AutomationManager.Provider.GetStateVisitors(removedState.Guid); if (stateVisistors.Any(t => t == user.Profile.UserName)) { AutomationManager.Provider.ChangeUserState(user.Profile.UserName, removedState.Guid, signupState.Guid); } AutomationManager.Provider.CreateAutomationState(user.Profile.UserName, eventItem.PlanId, signupState.ToGuid()); return(true); }
private async void CloseNowPlaying() { nowPlaying.ActionRequested -= NowPlaying_ActionRequested; topBar.InitTitleBar(); VisualStateManager.GoToState(this, nameof(NowPlayingClosingVisualState), false); await Task.Delay(200); VisualStateManager.GoToState(this, nameof(MainScreenVisualState), false); AnalyticsHelper.PageView("MainPage"); GetBackFocusToWebView(); }
public async Task <bool> TransferPlayback(string deviceId, bool ensurePlayback) { var ensurePlaybackString = ensurePlayback ? "true" : "false"; var data = $"{{\"device_ids\":[\"{deviceId}\"], \"play\": \"{ensurePlaybackString}\"}}"; var result = await SendJsonRequestWithTokenAsync("https://api.spotify.com/v1/me/player", HttpMethod.Put, data); if (result.IsSuccessStatusCode == false) { AnalyticsHelper.Log("api", "me/player:transferplayback::" + result.StatusCode.ToString()); } return(result.StatusCode == System.Net.HttpStatusCode.NoContent); }
private async void CloseCompactOverlay() { await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.Default); compactOverlayView.ExitCompactOverlayRequested -= CompactOverlayView_ExitCompactOverlayRequested; mainGrid.Children.Remove(compactOverlayView); compactOverlayView.PrepareToExit(); compactOverlayView = null; Window.Current.SetTitleBar(topBarBackground); AnalyticsHelper.Log("mainEvent", "compactOverlayClosed"); }
/// <summary> /// Set up this tank with the correct properties /// </summary> private void Initialize(TanksNetworkPlayer player) { if (initialized) { return; } initialized = true; this.player = player; playerTankType = TankLibrary.s_Instance.GetTankDataForIndex(player.tankType); // Create visual tank GameObject tankDisplay = (GameObject)Instantiate(playerTankType.displayPrefab, transform.position, transform.rotation); tankDisplay.transform.SetParent(transform, true); // Analytics messages on server if (isServer) { AnalyticsHelper.PlayerUsedTankInGame(playerTankType.id); TankDecorationDefinition itemData = TankDecorationLibrary.s_Instance.GetDecorationForIndex(player.tankDecoration); if (itemData.id != "none") { AnalyticsHelper.PlayerUsedDecorationInGame(itemData.id); } } // Get references to the components. display = tankDisplay.GetComponent <TankDisplay>(); movement = GetComponent <TankMovement>(); shooting = GetComponent <TankShooting>(); health = GetComponent <TankHealth>(); // Initialize components movement.Init(this); shooting.Init(this); health.Init(this); display.Init(this); GameManager.AddTank(this); if (player.hasAuthority) { DisableShooting(); player.CmdSetReady(); } }
// Update is called once per frame void Update() { LevelTime -= Time.deltaTime; if (LevelTime <= 0f) { var temp = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerDie>(); if (temp && !temp.Died) { AnalyticsHelper.LogSceneRestartEvent(SceneManager.GetActiveScene().name, AnalyticsHelper.PlayerDeath.timeout); temp.Die(); } Destroy(this); } }
public async void OpenDeveloperMessage(DeveloperMessage message) { await Task.Delay(700); while (whatsNewFlyout.Visibility == Visibility.Visible) { await Task.Delay(500); } developerMessageFlyout.InitFlyout(message); developerMessageFlyout.Visibility = Visibility.Visible; VisualStateManager.GoToState(this, nameof(OverlayVisibleVisualState), false); AnalyticsHelper.Log("flyoutShow", "developerMessage", message.id); }
public async Task <CurrentlyPlayingContext> GetCurrentlyPlaying() { //AnalyticsHelper.Log("api:me/getplayer"); var result = await SendRequestWithTokenAsync("https://api.spotify.com/v1/me/player", HttpMethod.Get); var resultString = await result.Content.ReadAsStringAsync(); if (result.IsSuccessStatusCode == false) { AnalyticsHelper.Log("api", "me/getplayer::" + result.StatusCode.ToString()); } return(JsonConvert.DeserializeObject <CurrentlyPlayingContext>(resultString)); }
protected void Page_Load(object sender, EventArgs e) { String siteName = CMSContext.CurrentSiteName; // Display disabled information if (!AnalyticsHelper.AnalyticsEnabled(siteName)) { this.pnlDisabled.Visible = true; this.lblDisabled.Text = GetString("WebAnalytics.Disabled") + "<br/>"; } if (!ABTestInfoProvider.ABTestingEnabled(siteName)) { this.pnlDisabled.Visible = true; this.lblABTestingDisabled.Text = GetString("abtesting.disabled"); } PageTitle title = this.CurrentMaster.Title; int testID = QueryHelper.GetInteger("abTestID", 0); editElem.TestID = testID; // Prepare the header string name = ""; title.HelpTopicName = "variant_edit"; if (editElem.VariantObj != null) { name = editElem.VariantObj.ABVariantDisplayName; title.TitleImage = GetImageUrl("Objects/CMS_Variant/object.png"); } else { name = GetString("abtesting.variant.new"); title.TitleImage = GetImageUrl("Objects/CMS_Variant/new.png"); } nodeID = QueryHelper.GetInteger("nodeID", 0); // Prepare the breadcrumbs string[,] breadcrumbs = new string[2, 3]; breadcrumbs[0, 0] = GetString("abtesting.variant.list"); breadcrumbs[0, 1] = "~/CMSModules/OnlineMarketing/Pages/Content/ABTesting/ABVariant/List.aspx?abTestID=" + testID + "&nodeid=" + nodeID; breadcrumbs[1, 0] = name; // Set the title title.Breadcrumbs = breadcrumbs; }
public static void ProcessSicCode(string clientIp, KickFireModel.RootObject model) { // Lets put the user into the right pattern if (string.IsNullOrWhiteSpace(model.data[0].sicCode)) { Log.Info("KickFire: No SicCode from Kickfire API call. IP is " + clientIp, "KickFire"); return; } var profileItem = Items.GetProfileItemBySicCode(model.data[0].sicCode); if (profileItem != null) { Log.Info("KickFire: Override SicCode for " + model.data[0].sicCode, "KickFire"); } // convert the response to our object var sicCodeModel = AnalyticsHelper.GetKickfireSicCodeModel(model.data[0].sicCode); if (sicCodeModel == null) { Log.Info("KickFire: Could not decode API call for " + model.data[0].sicCode, "Kickfire"); return; } // get the group by group name var groupItem = Items.GetSicGroup(sicCodeModel.Grouping); if (groupItem?.Fields[IDs.Fields.GroupParent.Profile] != null && ((LookupField)groupItem.Fields[IDs.Fields.GroupParent.Profile]).TargetItem != null) { // get profile key from group item profileItem = ((LookupField)groupItem.Fields[IDs.Fields.GroupParent.Profile]).TargetItem; } else { Log.Info("KickFire: Could not find group in Sitecore for " + sicCodeModel.Grouping, "Kickfire"); } if (profileItem == null) { Log.Info( "Profile Item is null. This is the lookup to the profile item from the Grouping item in Sitecore. ", "KickFire"); return; } ProcessProfile(profileItem); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { AnalyticsHelper.Initialize(Xamarin.Forms.Device.iOS); global::Xamarin.Forms.Forms.Init(); CachedImageRenderer.Init(); LoadApplication(new App()); UITextField.Appearance.TintColor = Xamarin.Forms.Color.FromHex("#2548D8").ToUIColor(); #if __TESTS__ Xamarin.Calabash.Start(); #endif return(base.FinishedLaunching(app, options)); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { RenderHeader(Item); if (isAlbum) { RenderAlbum(Item); } else { RenderImage(Item); } BindVotes(); ShareButton.SetCommand("Click", Item.ShareCommand); base.OnViewCreated(view, savedInstanceState); AnalyticsHelper.SendView("BrowserItem"); }
/// <summary> /// Sets all the debug settings to null and causes them to be reloaded. /// </summary> public static void ResetDebugSettings() { mAnyDebugLogToFileEnabled = null; SqlHelperClass.ResetDebugSettings(); AnalyticsHelper.ResetDebugSettings(); RequestHelper.ResetDebugSettings(); WebSyncHelperClass.ResetDebugSettings(); DebugHelper.ResetDebugSettings(); File.ResetDebugSettings(); SecurityHelper.ResetDebugSettings(); MacroResolver.ResetDebugSettings(); CacheHelper.ResetDebugSettings(); OutputHelper.ResetDebugSettings(); CMSControlsHelper.ResetDebugSettings(); CMSContext.ResetDebugSettings(); }
protected void Page_Load(object sender, EventArgs e) { CheckWebAnalyticsUI("ABTest.Overview"); ucDisplayReport = LoadControl("~/CMSModules/Reporting/Controls/DisplayReport.ascx") as IDisplayReport; pnlOverview.Controls.Add((Control)ucDisplayReport); ucConversionRateReport = LoadControl("~/CMSModules/Reporting/Controls/DisplayReport.ascx") as IDisplayReport; pnlConversionRate.Controls.Add((Control)ucConversionRateReport); ucTestValuesReport = LoadControl("~/CMSModules/Reporting/Controls/DisplayReport.ascx") as IDisplayReport; pnlConversionValue.Controls.Add((Control)ucTestValuesReport); listElem.ShowObjectMenu = false; CurrentMaster.PanelContent.CssClass = ""; String siteName = CMSContext.CurrentSiteName; UIHelper.AllowUpdateProgress = false; // Display disabled information if (!AnalyticsHelper.AnalyticsEnabled(siteName)) { this.pnlDisabled.Visible = true; this.lblDisabled.Text = GetString("WebAnalytics.Disabled") + "<br/>"; } if (!ABTestInfoProvider.ABTestingEnabled(siteName)) { this.pnlDisabled.Visible = true; this.lblABTestingDisabled.Text = GetString("abtesting.disabled"); } listElem.ShowFilter = false; listElem.DelayedReload = true; listElem.Grid.GridName = "~/CMSModules/OnlineMarketing/Controls/UI/ABTest/ListWithValues.xml"; lnkTestRate.NavigateUrl = "#"; lnkTestValue.NavigateUrl = "#"; lnkTestValue.Attributes["OnClick"] = "if (parent.parent.selectTreeNode != null) parent.parent.selectTreeNode('ABTest.ConversionsValue');parent.location=\"abtest_frameset.aspx?page=conversionsvalue&displayTab=abtesting.conversionsvalue\""; lnkTestRate.Attributes["OnClick"] = "if (parent.parent.selectTreeNode != null) parent.parent.selectTreeNode('ABTest.ConversionsRate');parent.location=\"abtest_frameset.aspx?page=conversionsrate&displayTab=abtesting.conversionrate\""; ucABTests.AllowAll = true; ucABTests.AllowEmpty = false; ucABTests.IsLiveSite = false; ucABTests.ReturnColumnName = "ABTestName"; ucABTests.PostbackOnChange = true; }
public Task NavigateToExampleAsync(ExampleInfo exampleInfo) { AnalyticsHelper.TraceNavigateToExample(exampleInfo); var viewModelType = typeof(ExampleViewModel); var page = this.CreatePage(viewModelType); var exampleViewModelType = this.GetExampleViewModelType(exampleInfo); if (exampleViewModelType != null) { viewModelType = exampleViewModelType; } return(InternalNavigateToAsync(page, viewModelType, null, exampleInfo)); }
/// <summary> /// EndGame state function /// </summary> protected void EndGame() { // If there is a game winner, wait for certain amount or all player confirmed to start a game again m_GameIsFinished = true; if (!m_GameSettings.isSinglePlayer) { //Ensure tanks are sorted correctly s_Tanks.Sort(TankSort); //Cache the length of the list int count = s_Tanks.Count; //iterate for (int i = 0; i < count; i++) { //Cache tank element TankManager tank = s_Tanks[i]; //Set the rank - this will be the same for all non-team based games int rank = m_RulesProcessor.GetRank(i); tank.SetRank(rank); //Add currency - NB! this is based on rank tank.SetAwardCurrency(m_RulesProcessor.GetAwardAmount(rank)); } } RpcGameEnd(); m_RulesProcessor.MatchEnd(); if (m_GameSettings.isSinglePlayer) { if (m_RulesProcessor.hasWinner) { AnalyticsHelper.SinglePlayerLevelCompleted(m_GameSettings.map.id, 3); } else { AnalyticsHelper.SinglePlayerLevelFailed(m_GameSettings.map.id); } } else { AnalyticsHelper.MultiplayerGameCompleted(m_GameSettings.map.id, m_GameSettings.mode.id, m_NumberOfPlayers, Mathf.RoundToInt(Time.timeSinceLevelLoad), m_RulesProcessor.winnerId); } m_State = GameState.PostGame; }
/// <summary> /// Logs web analytics data. /// </summary> private void LogWebAnalytics(UserInfo ui) { // Track successful registration conversion if (TrackConversionName != String.Empty) { if (AnalyticsHelper.AnalyticsEnabled(CurrentSiteName) && !AnalyticsHelper.IsIPExcluded(CurrentSiteName, RequestContext.UserHostAddress)) { HitLogProvider.LogConversions(CurrentSiteName, LocalizationContext.PreferredCultureCode, TrackConversionName, 0, ConversionValue); } } // Log registered user if confirmation is not required if (!ConfirmationRequired) { AnalyticsHelper.LogRegisteredUser(CurrentSiteName, ui); } }
/// <summary> /// Exits the active game and returns to menu. /// </summary> public void OnBailClicked() { NetworkManager netManager = NetworkManager.s_Instance; GameManager gameManager = GameManager.s_Instance; // There will be a local rules processor in single player if (m_Settings.isSinglePlayer) { AnalyticsHelper.SinglePlayerLevelQuit(m_Settings.map.id); Time.timeScale = m_OldTimeScale; } else { netManager.ReturnToMenu(MenuPage.Home); } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (!StopProcessing && AnalyticsHelper.IsLoggingEnabled(SiteContext.CurrentSiteName, DocumentContext.CurrentAliasPath) && Service.Resolve <IAnalyticsConsentProvider>().HasConsentForLogging()) { // If already in session or livesite .. do not register info calling if ((SessionHelper.GetValue("BrowserCapatibilities") == null) && ViewMode.IsLiveSite()) { Guid checkGuid = Guid.NewGuid(); String parameters = $"{LogResolution.ToString().ToLowerInvariant()},{LogColorDepth.ToString().ToLowerInvariant()},{LogOperatingSystem.ToString().ToLowerInvariant()},{LogSilverlight.ToString().ToLowerInvariant()},{LogJava.ToString().ToLowerInvariant()},{LogFlash.ToString().ToLowerInvariant()},'{ResolveUrl("~/CMSModules/WebAnalytics/Pages/Content/AnalyticsLog.aspx")}','{checkGuid.ToString()}'"; ScriptHelper.RegisterStartupScript(this, typeof(string), "BrowserCapatibilitiesInit", ScriptHelper.GetScript("collectBrowserData(" + parameters + ")")); ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/BrowserCapabilities.js"); SessionHelper.SetValue("BrowserCapatibilities", checkGuid.ToString()); } } }
protected void Page_Load(object sender, EventArgs e) { CheckWebAnalyticsUI("MVT.Overview"); String siteName = CMSContext.CurrentSiteName; CurrentMaster.PanelContent.CssClass = ""; ucDisplayReport = LoadControl("~/CMSModules/Reporting/Controls/DisplayReport.ascx") as IDisplayReport; pnlOverview.Controls.Add((Control)ucDisplayReport); ucConversionRateReport = LoadControl("~/CMSModules/Reporting/Controls/DisplayReport.ascx") as IDisplayReport; pnlConversionRate.Controls.Add((Control)ucConversionRateReport); ucTestValuesReport = LoadControl("~/CMSModules/Reporting/Controls/DisplayReport.ascx") as IDisplayReport; pnlConversionValue.Controls.Add((Control)ucTestValuesReport); // Display disabled information if (!AnalyticsHelper.AnalyticsEnabled(siteName)) { this.pnlDisabled.Visible = true; this.lblDisabled.Text = GetString("WebAnalytics.Disabled") + "<br/>"; } if (!MVTestInfoProvider.MVTestingEnabled(siteName)) { this.pnlDisabled.Visible = true; this.lblMVTestingDisabled.Text = GetString("mvt.disabled"); } listElem.DelayedReload = true; listElem.Grid.GridName = "~/CMSModules/OnlineMarketing/Controls/UI/MVTest/ListWithValues.xml"; listElem.Grid.Columns = "MVTestDisplayName,MVTestID,MVTestCulture,MVTestPage,MVTestOpenFrom,MVTestOpenTo,MVTestEnabled,MVTestConversions,MVTestSiteID,HitsValue"; listElem.ApplyTimeCondition = false; lnkTestRate.NavigateUrl = "#"; lnkTestValue.NavigateUrl = "#"; lnkTestValue.Attributes["OnClick"] = "if (parent.parent.selectTreeNode != null) parent.parent.selectTreeNode('MVTestConversionValue');parent.location=\"frameset.aspx?page=mvtreport&displayTab=abtesting.conversionsvalue&reportCodeName=mvtestconversionvalue.yearreport;mvtestconversionvalue.monthreport;mvtestconversionvalue.weekreport;mvtestconversionvalue.dayreport;mvtestconversionvalue.hourreport\""; lnkTestRate.Attributes["OnClick"] = "if (parent.parent.selectTreeNode != null) parent.parent.selectTreeNode('MVTestConversionRate');parent.location=\"frameset.aspx?page=mvtreport&displayTab=mvtest.conversionrate&reportCodeName=mvtestconversionrate.yearreport;mvtestconversionrate.monthreport;mvtestconversionrate.weekreport;mvtestconversionrate.dayreport;mvtestconversionrate.hourreport\""; ucMVTests.AllowAll = true; ucMVTests.AllowEmpty = false; ucMVTests.IsLiveSite = false; ucMVTests.ReturnColumnName = "MVTestName"; ucMVTests.PostbackOnChange = true; }
public static bool HasTokens() { try { return(CrossSecureStorage.Current.HasKey(accessTokenKey) && CrossSecureStorage.Current.HasKey(refreshTokenKey)); } catch (Exception ex) { if (!isLoggedHasTokensException) { AnalyticsHelper.Log("hasTokensException", ex.Message, ex.ToString()); isLoggedHasTokensException = true; } return(false); } }
/// <summary> /// OnAfterSave event handler /// </summary> protected void form_OnAfterSave(object sender, EventArgs e) { if (form.IsInsertMode) { if ((TrackConversionName != String.Empty)) { string siteName = SiteContext.CurrentSiteName; if (AnalyticsHelper.AnalyticsEnabled(siteName) && Service.Resolve <IAnalyticsConsentProvider>().HasConsentForLogging() && !AnalyticsHelper.IsIPExcluded(siteName, RequestContext.UserHostAddress)) { HitLogProvider.LogConversions(SiteContext.CurrentSiteName, LocalizationContext.PreferredCultureCode, TrackConversionName, 0, ConversionValue); } } // Redirect to edit mode after new item submit URLHelper.Redirect(URLHelper.AddParameterToUrl(RequestContext.CurrentURL, ItemKeyName, form.ItemID.ToString())); } }
// Update is called once per frame void Update() { if (died) { if (Input.GetKeyDown(KeyCode.R)) { GameController.RestartGame(); } return; } if (transform.position.y < minYPos) { AnalyticsHelper.LogSceneRestartEvent(SceneManager.GetActiveScene().name, AnalyticsHelper.PlayerDeath.fallthrough); Die(); } }
private static void LogPredictiveSearch(string keywords, bool PredictiveSearchLogSearchActivity, bool PredictiveSearchTrackSearchKeywords, int DocumentID, int UserID, bool forceLogging) { if (PredictiveSearchLogSearchActivity || PredictiveSearchTrackSearchKeywords || forceLogging) { TreeNode currentDocument = (TreeNode)CacheLastN(10, 60, new Func <int, int, TreeNode>(GetDocument), UserID, DocumentID); if (PredictiveSearchLogSearchActivity || forceLogging) { Activity internalSearch = new ActivityInternalSearch(keywords, currentDocument, AnalyticsContext.ActivityEnvironmentVariables); internalSearch.Log(); } if (PredictiveSearchTrackSearchKeywords || forceLogging) { AnalyticsHelper.LogOnSiteSearchKeywords(SiteContext.CurrentSiteName, currentDocument.NodeAliasPath, currentDocument.DocumentCulture, keywords, 0, 1); } } }
public void ProcessRequest(HttpContext context) { ID id; if (!ID.TryParse(context.Request.QueryString["goalId"], out id)) { Log.Warn("Cannot parse goal ID", this); return; } if (!AnalyticsHelper.TriggerGoal(id)) { Log.Warn("Goal triggering failed", this); return; } context.Response.Write("OK"); }
private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args) { if (args.SelectedItem == settingsMenuItem) { contentFrame.Navigate(typeof(SettingsPage), null, new EntranceNavigationTransitionInfo()); AnalyticsHelper.PageView("SettingsPage"); } else if (args.SelectedItem == aboutMenuItem) { contentFrame.Navigate(typeof(AboutPage), null, new EntranceNavigationTransitionInfo()); AnalyticsHelper.PageView("AboutPage"); } else if (args.SelectedItem == donateMenuItem) { contentFrame.Navigate(typeof(DonatePage), null, new EntranceNavigationTransitionInfo()); AnalyticsHelper.PageView("DonatePage"); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> protected void Page_Load(object sender, EventArgs e) { CurrentUserInfo cui = CMSContext.CurrentUser; // Check UI Permissions if (!cui.IsAuthorizedPerUIElement("CMS.Content", "OnlineMarketing.MVTVariants")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "OnlineMarketing.MVTVariants"); } if (!cui.IsAuthorizedPerResource("cms.mvtest", "Read")) { RedirectToAccessDenied(String.Format(GetString("general.permissionresource"), "Read", "MVT testing")); } if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "") { LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.MVTesting); } String siteName = CMSContext.CurrentSiteName; // Display disabled information if (!AnalyticsHelper.AnalyticsEnabled(siteName)) { this.pnlDisabled.Visible = true; this.lblWADisabled.Text = GetString("WebAnalytics.Disabled") + "<br/>"; } if (!MVTestInfoProvider.MVTestingEnabled(siteName)) { this.pnlDisabled.Visible = true; this.lblMVTestingDisabled.Text = GetString("mvt.disabled"); } // Set NodeID in order to check the access to the document listElem.NodeID = NodeID; // Get the PageTemplateID of the current node if (Node != null) { listElem.PageTemplateID = Node.DocumentPageTemplateID; } }
/// <summary> /// Approve user registration. /// </summary> private void ApproveRegistration() { string currentSiteName = SiteContext.CurrentSiteName; bool administrationApproval = SettingsKeyInfoProvider.GetBoolValue(currentSiteName + ".CMSRegistrationAdministratorApproval"); // Administrator approve is not required, enable user if (!administrationApproval) { ShowInformation(DataHelper.GetNotEmpty(SuccessfulApprovalText, GetString("mem.reg.succesfullapprovaltext"))); // Get logon link if confirmation was successful string logonlink = AuthenticationHelper.GetSecuredAreasLogonPage(currentSiteName); lblInfo.Text = String.Format(GetString("memberhsip.logonlink"), ResolveUrl(logonlink)); btnConfirm.Visible = false; // Enable user RegisteredUser.UserSettings.UserActivationDate = DateTime.Now; RegisteredUser.Enabled = true; // User is confirmed and enabled, could be logged into statistics AnalyticsHelper.LogRegisteredUser(currentSiteName, RegisteredUser); } // User must wait for administration approval else { ShowInformation(DataHelper.GetNotEmpty(WaitingForApprovalText, GetString("mem.reg.SuccessfulApprovalWaitingForAdministratorApproval"))); // Mark for admin approval RegisteredUser.UserSettings.UserWaitingForApproval = true; // Display link to home page lblInfo.Text = String.Format(GetString("general.gotohomepage"), DefaultUrl); btnConfirm.Visible = false; } // Save changes UserInfoProvider.SetUserInfo(RegisteredUser); // Notify administrator if enabled and email confirmation is not required if ((!String.IsNullOrEmpty(AdministratorEmail)) && (administrationApproval || NotifyAdministrator)) { SendEmailToAdministrator(administrationApproval); } }
public ActionResult Login(LoginModel model, string returnUrl) { if (ModelState.IsValid) { Sitecore.Security.Domains.Domain domain = Sitecore.Context.Domain; string domainUser = domain.Name + @"\" + model.UserName; if (Sitecore.Security.Authentication.AuthenticationManager.Login(domainUser, model.Password, model.RememberMe)) { // Register Goal & set a few values in the visit tags. AnalyticsHelper.RegisterGoalOnCurrentPage("Login", "[Login] Username: \"" + domainUser + "\""); AnalyticsHelper.SetVisitTagsOnLogin(domainUser, false); return(RedirectToLocal(returnUrl)); } } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "The user name or password provided is incorrect."); return(View(model)); }
public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { try { if (model.Password != model.ConfirmPassword) { throw new ApplicationException(GetDictionaryText("Passwords do not match")); } string domainUser = Sitecore.Context.Domain.GetFullName(model.Email); if (Sitecore.Security.Accounts.User.Exists(domainUser)) { throw new ApplicationException(GetDictionaryText("Already registered")); } System.Web.Security.Membership.CreateUser(domainUser, model.Password, model.Email); if (Sitecore.Security.Authentication.AuthenticationManager.Login(domainUser, model.Password, false)) { // Register Goal & set a few values in the visit tags. Sitecore.Context.User.Profile.FullName = model.FullName; Sitecore.Context.User.Profile.ProfileItemId = "{93B42F5F-17A9-441B-AB6D-444F714EF384}"; //LS User Sitecore.Context.User.Profile.Save(); AnalyticsHelper.RegisterGoalOnCurrentPage("Register", "[Register] Username: \"" + domainUser + "\""); AnalyticsHelper.SetVisitTagsOnLogin(domainUser, true); Sitecore.Web.WebUtil.Redirect("/"); } } catch (System.Web.Security.MembershipCreateUserException) { ModelState.AddModelError("", GetDictionaryText("Unable to register")); } catch (ApplicationException ex) { ModelState.AddModelError("", ex.Message); } } // If we got this far, something failed, redisplay form return(View(model)); }