November Happy Hour will be moved to Thursday December 5th.

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
Sep 19, 2006 9:20
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
Sep 19, 2006 10:10
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
Sep 19, 2006 10:58
Vote:
 
Thanks alot. What namespace is the class PasswordGenerator in btw?
#14884
Sep 19, 2006 11:30
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
Sep 19, 2006 12:04
* 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.