/// <summary>
 ///     Editor Part Constructor
 /// </summary>
 public MembershipRequestGroupEditor()
 {
     LocalizedString resourceManager;
     resourceManager = new LocalizedString("FBAPackMembershipRequestWebPart");
     this.ID = "GroupEditor";
     this.Title = resourceManager.GetString("GroupEditor_Title");
     this.Description = resourceManager.GetString("GroupEditor_Description");
 }
        private void AddPasswordRecoveryControl()
        {
            TemplateHelper helper;

            string provider = Utils.GetMembershipProvider(Context);

            //Exit if membership provider not defined
            if (provider == null || !Utils.IsProviderConfigured())
            {
                Controls.Add(new LiteralControl(LocalizedString.GetString("FBAPackFeatures", "MembershipNotConfigured")));
                return;
            }

            /* bms I couldn't figure out how to set the smtp server from code so I added the SendMailError as a hack for now */

            _ctlPasswordRecovery = new System.Web.UI.WebControls.PasswordRecovery();
            _ctlPasswordRecovery.UserNameTemplate = new TemplateLoader(UserNameTemplate, Page);
            _ctlPasswordRecovery.SuccessTemplate  = new TemplateLoader(SuccessTemplate, Page);
            _ctlPasswordRecovery.QuestionTemplate = new TemplateLoader(QuestionTemplate, Page);
            //bms Added the event to catch the error and send our own email
            _ctlPasswordRecovery.SendMailError      += new SendMailErrorEventHandler(_ctlPasswordRecovery_SendMailError);
            _ctlPasswordRecovery.VerifyingUser      += new LoginCancelEventHandler(_ctlPasswordRecovery_VerifyingUser);
            _ctlPasswordRecovery.SendingMail        += new MailMessageEventHandler(_ctlPasswordRecovery_SendingMail);
            _ctlPasswordRecovery.MembershipProvider  = provider;
            _ctlPasswordRecovery.GeneralFailureText  = GeneralFailureText;
            _ctlPasswordRecovery.QuestionFailureText = QuestionFailureText;
            _ctlPasswordRecovery.UserNameFailureText = UserNameFailureText;

            //UsernameTemplate
            helper = new TemplateHelper(_ctlPasswordRecovery.UserNameTemplateContainer);
            helper.SetText("UserNameInstruction", UserNameInstructionText);
            helper.SetText("UserNameLabel", UserNameLabelText);
            helper.SetText("UserNameTitle", UserNameTitleText);
            helper.SetValidation("UserNameRequired", UserNameRequiredErrorMessage, this.UniqueID);
            switch (SubmitButtonType)
            {
            case ButtonType.Button:
                helper.SetButton("SubmitButton", SubmitButtonText, this.UniqueID);
                helper.SetVisible("SubmitButton", true);
                break;

            case ButtonType.Image:
                helper.SetImageButton("SubmitImageButton", SubmitButtonImageUrl, SubmitButtonText, this.UniqueID);
                helper.SetVisible("SubmitImageButton", true);
                break;

            case ButtonType.Link:
                helper.SetButton("SubmitLinkButton", SubmitButtonText, this.UniqueID);
                helper.SetVisible("SubmitLinkButton", true);
                break;
            }

            //QuestionTemplate
            helper = new TemplateHelper(_ctlPasswordRecovery.QuestionTemplateContainer);
            helper.SetText("QuestionInstruction", QuestionInstructionText);
            helper.SetText("UserNameLabel", UserNameLabelText);
            helper.SetText("QuestionLabel", QuestionLabelText);
            helper.SetText("QuestionTitle", QuestionTitleText);
            helper.SetValidation("AnswerRequired", AnswerRequiredErrorMessage, this.UniqueID);
            switch (SubmitButtonType)
            {
            case ButtonType.Button:
                helper.SetButton("SubmitButton", SubmitButtonText, this.UniqueID);
                helper.SetVisible("SubmitButton", true);
                break;

            case ButtonType.Image:
                helper.SetImageButton("SubmitImageButton", SubmitButtonImageUrl, SubmitButtonText, this.UniqueID);
                helper.SetVisible("SubmitImageButton", true);
                break;

            case ButtonType.Link:
                helper.SetButton("SubmitLinkButton", SubmitButtonText, this.UniqueID);
                helper.SetVisible("SubmitLinkButton", true);
                break;
            }

            //SuccessTemplate
            helper = new TemplateHelper(_ctlPasswordRecovery.SuccessTemplateContainer);
            helper.SetText("Success", SuccessText);

            this.Controls.Add(_ctlPasswordRecovery);
        }