Ejemplo n.º 1
0
        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() );
            }
        }
Ejemplo n.º 2
0
        protected void btnTestForgot_Click( object sender, EventArgs e )
        {
            var emailManager = new EmailManager( this.Page );

             try {
                emailManager.SendForgotEmail( "coredweller", "empires", "*****@*****.**" );
            }
            catch ( Exception ex ) {
                lblOutput.Text = ex.ToString();
            }
        }
Ejemplo n.º 3
0
        protected void btnEmail_Click( object sender, EventArgs e )
        {
            if ( string.IsNullOrEmpty( txtEmail.Text ) ) {
                ShowError( "Please enter an email address." );
                return;
            }

            var emailAddress = txtEmail.Text.Trim();

            var user = _MembershipProvider.GetUserByEmail( emailAddress );
            if ( user == null ) {
                ShowError( "This email is not in our system. Please create a user." );
                return;
            }

            var emailManager = new EmailManager( this.Page );
            var success = emailManager.SendForgotEmail( user.UserName, user.GetPassword(), user.Email );

            ValidateSuccess( success, "An email has been sent with your requested information.", "There was an error processing your request. Please try again later." );
        }