private void Page_Load(object sender, System.EventArgs e) { GetGuidFromQueryString(); if (this.registrationConfirmationGuid == Guid.Empty) { WebUtils.SetupRedirect(this, SiteRoot); return; } SiteUser siteUser = SiteUser.GetByConfirmationGuid(siteSettings, registrationConfirmationGuid); if (SiteUser.ConfirmRegistration(this.registrationConfirmationGuid)) { this.lblMessage.Text = Resources.Resource.RegisterConfirmMessage; if (siteUser != null) { NewsletterHelper.ClaimExistingSubscriptions(siteUser); } CGoogleAnalyticsScript analytics = Page.Master.FindControl("CGoogleAnalyticsScript1") as CGoogleAnalyticsScript; if (analytics == null) { return; } analytics.PageToTrack = "/RegistrationConfirmed.aspx"; } else { WebUtils.SetupRedirect(this, SiteRoot); return; } }
private void CreateUser(string windowsLiveId) { SiteUser newUser = new SiteUser(siteSettings); newUser.WindowsLiveId = windowsLiveId; newUser.Name = txtUserName.Text; newUser.LoginName = txtUserName.Text; newUser.Email = txtEmail.Text; CMembershipProvider CMembership = (CMembershipProvider)Membership.Provider; newUser.Password = CMembership.EncodePassword(SiteUser.CreateRandomPassword(7), siteSettings); //newUser.Password = SiteUser.CreateRandomPassword(7); newUser.PasswordQuestion = Resource.ManageUsersDefaultSecurityQuestion; newUser.PasswordAnswer = Resource.ManageUsersDefaultSecurityAnswer; newUser.Save(); if (siteSettings.UseSecureRegistration) { newUser.SetRegistrationConfirmationGuid(Guid.NewGuid()); } CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig(); // set default values first foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { CProfilePropertyDefinition.SavePropertyDefault( newUser, propertyDefinition); } foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { if (propertyDefinition.RequiredForRegistration) { CProfilePropertyDefinition.SaveProperty( newUser, pnlRequiredProfileProperties, propertyDefinition, timeOffset); } } // track user ip address UserLocation userLocation = new UserLocation(newUser.UserGuid, SiteUtils.GetIP4Address()); userLocation.SiteGuid = siteSettings.SiteGuid; userLocation.Hostname = Page.Request.UserHostName; userLocation.Save(); UserRegisteredEventArgs u = new UserRegisteredEventArgs(newUser); OnUserRegistered(u); CacheHelper.TouchMembershipStatisticsCacheDependencyFile(); NewsletterHelper.ClaimExistingSubscriptions(newUser); DoUserLogin(newUser); }
private void Page_Load(object sender, System.EventArgs e) { LoadSettings(); GetGuidFromQueryString(); if (this.registrationConfirmationGuid == Guid.Empty) { WebUtils.SetupRedirect(this, SiteRoot); return; } SiteUser siteUser = SiteUser.GetByConfirmationGuid(siteSettings, registrationConfirmationGuid); if (SiteUser.ConfirmRegistration(this.registrationConfirmationGuid)) { this.lblMessage.Text = Resources.Resource.RegisterConfirmMessage; if (siteUser != null) { NewsletterHelper.VerifyExistingSubscriptions(siteUser); NewsletterHelper.ClaimExistingSubscriptions(siteUser); if ((windowsLive != null) && (liveUser != null)) { HandleWindowsLiveConfirmation(siteUser); } } AnalyticsAsyncTopScript asyncAnalytics = Page.Master.FindControl("analyticsTop") as AnalyticsAsyncTopScript; if (asyncAnalytics != null) { asyncAnalytics.PageToTrack = "/RegistrationConfirmed.aspx"; } else { mojoGoogleAnalyticsScript analytics = Page.Master.FindControl("mojoGoogleAnalyticsScript1") as mojoGoogleAnalyticsScript; if (analytics != null) { analytics.PageToTrack = "/RegistrationConfirmed.aspx"; } } } else { WebUtils.SetupRedirect(this, SiteRoot); return; } }
private void CreateUser( string openId, string email, string loginName, string name) { SiteUser newUser = new SiteUser(siteSettings); newUser.Email = email; if (loginName.Length > 50) { loginName = loginName.Substring(0, 50); } int i = 1; while (SiteUser.LoginExistsInDB( siteSettings.SiteId, loginName)) { loginName += i.ToString(); if (loginName.Length > 50) { loginName = loginName.Remove(40, 1); } i++; } if ((name == null) || (name.Length == 0)) { name = loginName; } newUser.LoginName = loginName; newUser.Name = name; //newUser.Password = SiteUser.CreateRandomPassword(7); mojoMembershipProvider mojoMembership = (mojoMembershipProvider)Membership.Provider; newUser.Password = mojoMembership.EncodePassword(siteSettings, newUser, SiteUser.CreateRandomPassword(7, WebConfigSettings.PasswordGeneratorChars)); newUser.PasswordQuestion = Resource.ManageUsersDefaultSecurityQuestion; newUser.PasswordAnswer = Resource.ManageUsersDefaultSecurityAnswer; newUser.OpenIdUri = openId; newUser.Save(); if (siteSettings.UseSecureRegistration) { newUser.SetRegistrationConfirmationGuid(Guid.NewGuid()); } mojoProfileConfiguration profileConfig = mojoProfileConfiguration.GetConfig(); // set default values first foreach (mojoProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { mojoProfilePropertyDefinition.SavePropertyDefault( newUser, propertyDefinition); } foreach (mojoProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { if ((propertyDefinition.RequiredForRegistration) || (propertyDefinition.ShowOnRegistration)) { mojoProfilePropertyDefinition.SaveProperty( newUser, pnlRequiredProfileProperties, propertyDefinition, timeOffset, timeZone); } } // track user ip address UserLocation userLocation = new UserLocation(newUser.UserGuid, SiteUtils.GetIP4Address()); userLocation.SiteGuid = siteSettings.SiteGuid; userLocation.Hostname = Page.Request.UserHostName; userLocation.Save(); UserRegisteredEventArgs u = new UserRegisteredEventArgs(newUser); OnUserRegistered(u); CacheHelper.ClearMembershipStatisticsCache(); NewsletterHelper.ClaimExistingSubscriptions(newUser); DoUserLogin(newUser); }
private SiteUser CreateUser( string openId, string email, string loginName, string name, bool emailIsVerified) { SiteUser newUser = new SiteUser(siteSettings); newUser.Email = email; if (loginName.Length > 50) { loginName = loginName.Substring(0, 50); } int i = 1; while (SiteUser.LoginExistsInDB( siteSettings.SiteId, loginName)) { loginName += i.ToString(); if (loginName.Length > 50) { loginName = loginName.Remove(40, 1); } i++; } if ((name == null) || (name.Length == 0)) { name = loginName; } newUser.LoginName = loginName; newUser.Name = name; //newUser.Password = SiteUser.CreateRandomPassword(7); mojoMembershipProvider mojoMembership = (mojoMembershipProvider)Membership.Provider; newUser.Password = mojoMembership.EncodePassword(siteSettings, newUser, SiteUser.CreateRandomPassword(7, WebConfigSettings.PasswordGeneratorChars)); newUser.PasswordQuestion = Resource.ManageUsersDefaultSecurityQuestion; newUser.PasswordAnswer = Resource.ManageUsersDefaultSecurityAnswer; newUser.OpenIdUri = openId; newUser.Save(); //test //emailIsVerified = false; if (siteSettings.UseSecureRegistration) { if (!emailIsVerified) { newUser.SetRegistrationConfirmationGuid(Guid.NewGuid()); } } mojoProfileConfiguration profileConfig = mojoProfileConfiguration.GetConfig(); // set default values first foreach (mojoProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { // we are using the new TimeZoneInfo list but it doesn't work under Mono // this makes us skip the TimeOffsetHours setting from mojoProfile.config which is not used under windows if (propertyDefinition.Name == mojoProfilePropertyDefinition.TimeOffsetHoursKey) { continue; } mojoProfilePropertyDefinition.SavePropertyDefault( newUser, propertyDefinition); } foreach (mojoProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { // we are using the new TimeZoneInfo list but it doesn't work under Mono // this makes us skip the TimeOffsetHours setting from mojoProfile.config which is not used under windows if (propertyDefinition.Name == mojoProfilePropertyDefinition.TimeOffsetHoursKey) { continue; } if ((propertyDefinition.RequiredForRegistration) || (propertyDefinition.ShowOnRegistration)) { mojoProfilePropertyDefinition.SaveProperty( newUser, pnlRequiredProfileProperties, propertyDefinition, timeOffset, timeZone); } } // track user ip address UserLocation userLocation = new UserLocation(newUser.UserGuid, SiteUtils.GetIP4Address()); userLocation.SiteGuid = siteSettings.SiteGuid; userLocation.Hostname = Page.Request.UserHostName; userLocation.Save(); UserRegisteredEventArgs u = new UserRegisteredEventArgs(newUser); OnUserRegistered(u); CacheHelper.ClearMembershipStatisticsCache(); // we'll map them next time they login //OpenIdRpxHelper rpxHelper = new OpenIdRpxHelper(rpxApiKey, rpxBaseUrl); //rpxHelper.Map(openId, newUser.UserGuid.ToString()); DoSubscribe(newUser); NewsletterHelper.ClaimExistingSubscriptions(newUser); return(newUser); }
private void CreateUser(string windowsLiveId) { SiteUser newUser = new SiteUser(siteSettings); newUser.WindowsLiveId = windowsLiveId; newUser.Name = SecurityHelper.RemoveMarkup(txtUserName.Text); newUser.LoginName = newUser.Name; newUser.Email = txtEmail.Text; mojoMembershipProvider mojoMembership = (mojoMembershipProvider)Membership.Provider; newUser.Password = mojoMembership.EncodePassword(siteSettings, newUser, SiteUser.CreateRandomPassword(7, WebConfigSettings.PasswordGeneratorChars)); //newUser.Password = SiteUser.CreateRandomPassword(7); newUser.PasswordQuestion = Resource.ManageUsersDefaultSecurityQuestion; newUser.PasswordAnswer = Resource.ManageUsersDefaultSecurityAnswer; newUser.Save(); if (siteSettings.UseSecureRegistration) { newUser.SetRegistrationConfirmationGuid(Guid.NewGuid()); } mojoProfileConfiguration profileConfig = mojoProfileConfiguration.GetConfig(); // set default values first foreach (mojoProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { #if !MONO // we are using the new TimeZoneInfo list but it doesn't work under Mono // this makes us skip the TimeOffsetHours setting from mojoProfile.config which is not used under windows if (propertyDefinition.Name == mojoProfilePropertyDefinition.TimeOffsetHoursKey) { continue; } #endif mojoProfilePropertyDefinition.SavePropertyDefault( newUser, propertyDefinition); } foreach (mojoProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { #if !MONO // we are using the new TimeZoneInfo list but it doesn't work under Mono // this makes us skip the TimeOffsetHours setting from mojoProfile.config which is not used under windows if (propertyDefinition.Name == mojoProfilePropertyDefinition.TimeOffsetHoursKey) { continue; } #endif if ((propertyDefinition.RequiredForRegistration) || (propertyDefinition.ShowOnRegistration)) { mojoProfilePropertyDefinition.SaveProperty( newUser, pnlRequiredProfileProperties, propertyDefinition, timeOffset, timeZone); } } // track user ip address UserLocation userLocation = new UserLocation(newUser.UserGuid, SiteUtils.GetIP4Address()); userLocation.SiteGuid = siteSettings.SiteGuid; userLocation.Hostname = Page.Request.UserHostName; userLocation.Save(); UserRegisteredEventArgs u = new UserRegisteredEventArgs(newUser); OnUserRegistered(u); CacheHelper.ClearMembershipStatisticsCache(); NewsletterHelper.ClaimExistingSubscriptions(newUser); DoUserLogin(newUser); }
private SiteUser CreateUser( string openId, string email, string loginName, string name, bool emailIsVerified) { SiteUser newUser = new SiteUser(siteSettings); newUser.Email = email; if (loginName.Length > 50) { loginName = loginName.Substring(0, 50); } int i = 1; while (SiteUser.LoginExistsInDB( siteSettings.SiteId, loginName)) { loginName += i.ToString(); if (loginName.Length > 50) { loginName = loginName.Remove(40, 1); } i++; } if ((name == null) || (name.Length == 0)) { name = loginName; } newUser.LoginName = loginName; newUser.Name = name; //newUser.Password = SiteUser.CreateRandomPassword(7); CMembershipProvider CMembership = (CMembershipProvider)Membership.Provider; newUser.Password = CMembership.EncodePassword(SiteUser.CreateRandomPassword(7), siteSettings); newUser.PasswordQuestion = Resource.ManageUsersDefaultSecurityQuestion; newUser.PasswordAnswer = Resource.ManageUsersDefaultSecurityAnswer; newUser.OpenIdUri = openId; newUser.Save(); if (siteSettings.UseSecureRegistration) { if (!emailIsVerified) { newUser.SetRegistrationConfirmationGuid(Guid.NewGuid()); } } CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig(); // set default values first foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { CProfilePropertyDefinition.SavePropertyDefault( newUser, propertyDefinition); } foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { if (propertyDefinition.RequiredForRegistration) { CProfilePropertyDefinition.SaveProperty( newUser, pnlRequiredProfileProperties, propertyDefinition, timeOffset); } } // track user ip address UserLocation userLocation = new UserLocation(newUser.UserGuid, SiteUtils.GetIP4Address()); userLocation.SiteGuid = siteSettings.SiteGuid; userLocation.Hostname = Page.Request.UserHostName; userLocation.Save(); UserRegisteredEventArgs u = new UserRegisteredEventArgs(newUser); OnUserRegistered(u); CacheHelper.TouchMembershipStatisticsCacheDependencyFile(); // we'll map them next time they login //OpenIdRpxHelper rpxHelper = new OpenIdRpxHelper(rpxApiKey, rpxBaseUrl); //rpxHelper.Map(openId, newUser.UserGuid.ToString()); NewsletterHelper.ClaimExistingSubscriptions(newUser); return(newUser); }