private void LoadSettings() { siteSettings = CacheHelper.GetCurrentSiteSettings(); siteRoot = SiteUtils.GetNavigationSiteRoot(); winliveCookieName = "winliveid" + siteSettings.SiteId.ToString(CultureInfo.InvariantCulture); returnUrlCookieName = "ret" + siteSettings.SiteId.ToString(CultureInfo.InvariantCulture); litSignInAddendum.Text = Resource.WindowsLiveSignInAddendum; if (SiteUtils.SslIsAvailable()) { protocol = "https://"; } string wlAppId = siteSettings.WindowsLiveAppId; if (ConfigurationManager.AppSettings["GlobalWindowsLiveAppId"] != null) { wlAppId = ConfigurationManager.AppSettings["GlobalWindowsLiveAppId"].Trim(); if (wlAppId.Length == 0) { wlAppId = siteSettings.WindowsLiveAppId.Trim(); } } if (wlAppId.Length > 0) { try { windowsLive = WindowsLiveHelper.GetWindowsLiveLogin(); if (windowsLive == null) { this.Visible = false; return; } windowsLiveAppId = windowsLive.AppId; } catch (ArgumentException) { windowsLive = null; } } }
private void LoadSettings() { Title = SiteUtils.FormatPageTitle(siteSettings, Resource.RegistrationConfirmation); winliveCookieName = "winliveid" + siteSettings.SiteId.ToInvariantString(); windowsLive = WindowsLiveHelper.GetWindowsLiveLogin(); if (windowsLive == null) { return; } string winLiveToken = CookieHelper.GetCookieValue(winliveCookieName); if (winLiveToken.Length > 0) { liveUser = windowsLive.ProcessToken(winLiveToken); } AddClassToBody("confirmregistration"); }
private void LoadSettings() { timeOffset = SiteUtils.GetUserTimeOffset(); timeZone = SiteUtils.GetUserTimeZone(); if (SiteUtils.SslIsAvailable()) { protocol = "https://"; } mojoProfileConfiguration profileConfig = mojoProfileConfiguration.GetConfig(); foreach (mojoProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { if ((propertyDefinition.RequiredForRegistration) || (propertyDefinition.ShowOnRegistration)) { requiredProfileProperties.Add(propertyDefinition); } } winliveCookieName = "winliveid" + siteSettings.SiteId.ToString(CultureInfo.InvariantCulture); windowsLive = WindowsLiveHelper.GetWindowsLiveLogin(); if (windowsLive == null) { return; } windowsLiveAppId = windowsLive.AppId; string winLiveToken = CookieHelper.GetCookieValue(winliveCookieName); if (winLiveToken.Length > 0) { liveUser = windowsLive.ProcessToken(winLiveToken); } AddClassToBody("registerwinlivepage"); }
private void PopulateControls() { this.lnkChangePassword.NavigateUrl = SiteRoot + "/Secure/ChangePassword.aspx"; this.lnkChangePassword.Text = Resource.UserChangePasswordLabel; ListItem listItem; if (allowUserSkin) { if (siteUser != null) { SkinSetting.SetValue(siteUser.Skin); } } if ((siteSettings.AllowUserEditorPreference) && (siteUser != null) && (siteUser.EditorPreference.Length > 0)) { listItem = ddEditorProviders.Items.FindByValue(siteUser.EditorPreference); if (listItem != null) { ddEditorProviders.ClearSelection(); listItem.Selected = true; } } if (siteUser != null) { #if !MONO ISettingControl setting = timeZoneSetting as ISettingControl; if (setting != null) { setting.SetValue(siteUser.TimeZoneId); } #endif txtName.Text = SecurityHelper.RemoveMarkup(siteUser.Name); txtName.Enabled = siteSettings.AllowUserFullNameChange; lblLoginName.Text = SecurityHelper.RemoveMarkup(siteUser.LoginName); txtEmail.Text = siteUser.Email; //gravatar1.Email = siteUser.Email; lblOpenID.Text = siteUser.OpenIdUri; txtPasswordQuestion.Text = siteUser.PasswordQuestion; txtPasswordAnswer.Text = siteUser.PasswordAnswer; lblCreatedDate.Text = siteUser.DateCreated.AddHours(timeOffset).ToString(); lblTotalPosts.Text = siteUser.TotalPosts.ToString(); lnkUserPosts.UserId = siteUser.UserId; lnkUserPosts.TotalPosts = siteUser.TotalPosts; //lnkPublicProfile.NavigateUrl = SiteRoot + "/ProfileView.aspx?userid=" + siteUser.UserId.ToInvariantString(); lnkPubProfile.NavigateUrl = SiteRoot + "/ProfileView.aspx?userid=" + siteUser.UserId.ToInvariantString(); if (divLiveMessenger.Visible) { WindowsLiveLogin wl = WindowsLiveHelper.GetWindowsLiveLogin(); WindowsLiveMessenger m = new WindowsLiveMessenger(wl); if (WebConfigSettings.TestLiveMessengerDelegation) { lnkAllowLiveMessenger.NavigateUrl = m.ConsentOptInUrl; } else { lnkAllowLiveMessenger.NavigateUrl = m.NonDelegatedSignUpUrl; } if (siteUser.LiveMessengerId.Length > 0) { chkEnableLiveMessengerOnProfile.Checked = siteUser.EnableLiveMessengerOnProfile; chkEnableLiveMessengerOnProfile.Enabled = true; } else { chkEnableLiveMessengerOnProfile.Checked = false; chkEnableLiveMessengerOnProfile.Enabled = false; } } //if ((!allowGravatars)&&(!disableAvatars)) //{ // if (siteUser.AvatarUrl.Length > 0) // { // imgAvatar.Src = avatarPath + siteUser.AvatarUrl; // } // else // { // imgAvatar.Src = Page.ResolveUrl(WebConfigSettings.DefaultBlankAvatarPath); // } //} userAvatar.UseGravatar = allowGravatars; userAvatar.Email = siteUser.Email; userAvatar.UserName = siteUser.Name; userAvatar.UserId = siteUser.UserId; userAvatar.AvatarFile = siteUser.AvatarUrl; userAvatar.MaxAllowedRating = MaxAllowedGravatarRating; userAvatar.Disable = disableAvatars; userAvatar.SiteId = siteSettings.SiteId; userAvatar.UseLink = false; } // this doesn't work //DoTabSelection(); }
private void DoLogout() { SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings(); string winliveCookieName = "winliveid" + siteSettings.SiteId.ToString(CultureInfo.InvariantCulture); string roleCookieName = SiteUtils.GetRoleCookieName(siteSettings); HttpCookie roleCookie = new HttpCookie(roleCookieName, string.Empty); roleCookie.Expires = DateTime.Now.AddMinutes(1); roleCookie.Path = "/"; Response.Cookies.Add(roleCookie); HttpCookie displayNameCookie = new HttpCookie("DisplayName", string.Empty); displayNameCookie.Expires = DateTime.Now.AddMinutes(1); displayNameCookie.Path = "/"; Response.Cookies.Add(displayNameCookie); // apparently we need this here for folder sites using windows auth //https://www.mojoportal.com/Forums/EditPost.aspx?thread=13195&forumid=2&mid=34&pageid=5&pagenumber=1 CookieHelper.ExpireCookie("siteguid" + siteSettings.SiteGuid); bool useFolderForSiteDetection = ConfigHelper.GetBoolProperty("UseFoldersInsteadOfHostnamesForMultipleSites", false); if ((useFolderForSiteDetection) && (!WebConfigSettings.UseRelatedSiteMode)) { string cookieName = "siteguid" + siteSettings.SiteGuid.ToString(); HttpCookie siteCookie = new HttpCookie(cookieName, string.Empty); siteCookie.Expires = DateTime.Now.AddMinutes(1); siteCookie.Path = "/"; Response.Cookies.Add(siteCookie); CookieHelper.ExpireCookie("siteguid" + siteSettings.SiteGuid); } else { FormsAuthentication.SignOut(); } string winLiveToken = CookieHelper.GetCookieValue(winliveCookieName); WindowsLiveLogin.User liveUser = null; if (winLiveToken.Length > 0) { WindowsLiveLogin windowsLive = WindowsLiveHelper.GetWindowsLiveLogin(); try { liveUser = windowsLive.ProcessToken(winLiveToken); if (liveUser != null) { Response.Redirect(windowsLive.GetLogoutUrl()); Response.End(); } } catch (InvalidOperationException) { } } try { if (Session != null) { Session.Clear(); Session.Abandon(); } } catch (HttpException) { } string redirectUrl = SiteUtils.GetNavigationSiteRoot() + "/Default.aspx"; if (!siteSettings.UseSslOnAllPages) { if (redirectUrl.StartsWith("https:")) { redirectUrl = redirectUrl.Replace("https:", "http:"); } } WebUtils.SetupRedirect(this, redirectUrl); }
private void DoLogout() { SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings(); string winliveCookieName = "winliveid" + siteSettings.SiteId.ToString(CultureInfo.InvariantCulture); string roleCookieName = SiteUtils.GetRoleCookieName(siteSettings); HttpCookie roleCookie = new HttpCookie(roleCookieName, string.Empty); roleCookie.Expires = DateTime.Now.AddMinutes(1); roleCookie.Path = "/"; Response.Cookies.Add(roleCookie); HttpCookie displayNameCookie = new HttpCookie("DisplayName", string.Empty); displayNameCookie.Expires = DateTime.Now.AddMinutes(1); displayNameCookie.Path = "/"; Response.Cookies.Add(displayNameCookie); bool useFolderForSiteDetection = ConfigHelper.GetBoolProperty("UseFoldersInsteadOfHostnamesForMultipleSites", false); if ((useFolderForSiteDetection) && (!WebConfigSettings.UseRelatedSiteMode)) { string cookieName = "siteguid" + siteSettings.SiteGuid.ToString(); HttpCookie siteCookie = new HttpCookie(cookieName, string.Empty); siteCookie.Expires = DateTime.Now.AddMinutes(1); siteCookie.Path = "/"; Response.Cookies.Add(siteCookie); } else { FormsAuthentication.SignOut(); } string winLiveToken = CookieHelper.GetCookieValue(winliveCookieName); WindowsLiveLogin.User liveUser = null; if (winLiveToken.Length > 0) { WindowsLiveLogin windowsLive = WindowsLiveHelper.GetWindowsLiveLogin(); try { liveUser = windowsLive.ProcessToken(winLiveToken); if (liveUser != null) { Response.Redirect(windowsLive.GetLogoutUrl()); Response.End(); } } catch (InvalidOperationException) { } } try { if (Session != null) { Session.Abandon(); } } catch (HttpException) { } WebUtils.SetupRedirect(this, SiteUtils.GetNavigationSiteRoot() + "/Default.aspx"); }
private void PopulateControls() { this.lnkChangePassword.NavigateUrl = SiteRoot + "/Secure/ChangePassword.aspx"; this.lnkChangePassword.Text = Resource.UserChangePasswordLabel; if (siteSettings.AllowUserSkins) { this.ddSkins.DataSource = SiteUtils.GetSkinList(this.siteSettings); this.ddSkins.DataBind(); ListItem listItem; listItem = this.ddSkins.Items.FindByValue("printerfriendly"); if (listItem != null) { this.ddSkins.Items.Remove(listItem); } listItem = this.ddSkins.Items.FindByValue(".svn"); if (listItem != null) { this.ddSkins.Items.Remove(listItem); } listItem = new ListItem(); listItem.Value = ""; listItem.Text = Resource.PageLayoutDefaultSkinLabel; this.ddSkins.Items.Insert(0, listItem); if (siteUser != null) { if (siteUser.Skin.Length > 0) { listItem = ddSkins.Items.FindByValue(siteUser.Skin); if (listItem != null) { ddSkins.ClearSelection(); listItem.Selected = true; } } } } if (siteUser != null) { txtName.Text = siteUser.Name; lblLoginName.Text = siteUser.LoginName; txtEmail.Text = siteUser.Email; gravatar1.Email = siteUser.Email; lblOpenID.Text = siteUser.OpenIdUri; txtPasswordQuestion.Text = siteUser.PasswordQuestion; txtPasswordAnswer.Text = siteUser.PasswordAnswer; lblCreatedDate.Text = siteUser.DateCreated.AddHours(timeOffset).ToString(); lblTotalPosts.Text = siteUser.TotalPosts.ToString(); lnkUserPosts.UserId = siteUser.UserId; lnkUserPosts.TotalPosts = siteUser.TotalPosts; lnkPublicProfile.NavigateUrl = SiteRoot + "/ProfileView.aspx?userid=" + siteUser.UserId.ToString(CultureInfo.InvariantCulture); if (divLiveMessenger.Visible) { WindowsLiveLogin wl = WindowsLiveHelper.GetWindowsLiveLogin(); WindowsLiveMessenger m = new WindowsLiveMessenger(wl); if (WebConfigSettings.TestLiveMessengerDelegation) { lnkAllowLiveMessenger.NavigateUrl = m.ConsentOptInUrl; } else { lnkAllowLiveMessenger.NavigateUrl = m.NonDelegatedSignUpUrl; } if (siteUser.LiveMessengerId.Length > 0) { chkEnableLiveMessengerOnProfile.Checked = siteUser.EnableLiveMessengerOnProfile; chkEnableLiveMessengerOnProfile.Enabled = true; } else { chkEnableLiveMessengerOnProfile.Checked = false; chkEnableLiveMessengerOnProfile.Enabled = false; } } if ((!allowGravatars) && (!disableAvatars)) { if (siteUser.AvatarUrl.Length > 0) { //if (!WebConfigSettings.OnlyAdminsCanEditCheesyAvatars) //{ // ddAvatars.SelectedValue = siteUser.AvatarUrl; //} imgAvatar.Src = avatarPath + siteUser.AvatarUrl; } else { imgAvatar.Src = Page.ResolveUrl("~/Data/SiteImages/1x1.gif"); } } } DoTabSelection(); }