Create User for subscription

Vote:
 
I will like users to be able to register for subscriptions only by entering their eMail. I know that I then have to create a new user based on the class EPiServer.DataAbstraction.UserSid and then add this user to my spesific group of users (subscription users). Am I on the right track here? Is there anyone who has examples of something like this?
#12779
Mar 25, 2008 18:35
Vote:
 
Hi, you are on the right track. See code below: UserSid sid = UserSid.Load(txtEmail.Text); //CREATE USER if( sid == null ) { sid = new UserSid(EPiServer.Security.SecurityIdentityType.ExtranetUser); sid.Name = txtEmail.Text; PasswordGenerator pwdGen = new PasswordGenerator(); strPassword = pwdGen.Generate(); sid.Password = strPassword; sid.Active = true; sid.Save();
#14882
Mar 25, 2008 18:46
Vote:
 
After that, you can use the SubscriptionInfo class to subscribe the user to any of the available subsciption pages you've got. I don't think you need to activate the user in order to have the emails sent out. If the user does not know the randomly generated password, there is no need to activate her account. /Steve
#14883
Mar 25, 2008 18:46
Vote:
 
Thanks alot. What namespace is the class PasswordGenerator in btw?
#14884
Mar 25, 2008 18:46
Vote:
 
Hi, its our own function to generate a password (a normal string). But you can set your password to anything, because your subscribers will never have to "log into" your website. Thanks Danie
#14885
Mar 25, 2008 18:46
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.