To alter this behavior you will need to get the user and update the IsApproved field.
If you are simply using Sitecore.Security.Account.User.Create() then you just need to do the following:
// Create a new user in the system
newUser = User.Create(userName, password);
// Since we just created the user they should not be approved yet.
MembershipUser user = GetMembershipUserByUserName(userName);
user.IsApproved = false;
Membership.UpdateUser(user);
If you are using the wizard here is the event code.
Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e AsSystem.EventArgs) Handles CreateUserWizard1.CreatedUser
' Set Account to IsApproved=False
Dim Usr As MembershipUser = Membership.GetUser(Me.CreateUserWizard1.UserName, True)
Usr.IsApproved = False
Membership.UpdateUser(Usr)
End Sub
I got this information from a forum post about
How to send confirmation email to newly registering user via CreateUserWizard
If you found this article useful be sure to pass it on. If you have any tips, tricks or resources you would like to share with the Guild please email them to sitecoreguild@outlook.com
No comments:
Post a Comment