public void createControl_CreatedUser( object sender, EventArgs e )
        {
            bool success = false;
            CreateUserWizard cont = null;

            try {
                cont = (CreateUserWizard)sender;

                _RoleProvider.AddUsersToRoles( new string[1] { cont.UserName }, new string[1] { Core.Membership.Roles.REGISTERED } );

                var profileService = new ProfileService( cont.UserName );
                var profile = profileService.GetUserProfile();
                profile.Public = false;
                profile.ButtonSize = DefaultButtonSize;
                profile.FontSize = DefaultFontSize;
                profile.Save();

                success = true;
            }
            catch ( Exception ex ) {
                _Log.WriteFatal( "There was a major error creating a new user with a message of: " + ex.Message );
            }

            //If they successfully create a new user then send a welcome email and take them to the main page
            //  Otherwise it will show them an error or in a fatal case it will take them to Login.
            if ( success && cont != null ) {
                var emailManager = new EmailManager( this.Page );
                emailManager.SendWelcomeEmail( cont.UserName, cont.Password, cont.Email );

                System.Web.Security.FormsAuthentication.RedirectFromLoginPage( cont.UserName, true );
                Response.Redirect( LinkBuilder.DefaultMainLink() );
            }
        }
Beispiel #2
0
        protected void btnTestWelcome_Click( object sender, EventArgs e )
        {
            var emailManager = new EmailManager( this.Page );

             try {
                emailManager.SendWelcomeEmail( "coredweller", "empires", "*****@*****.**" );
            }
            catch ( Exception ex ) {
                lblOutput.Text = ex.ToString();
            }

            //SendEmail( null );
        }