///////////////////////////////////////////////////////// // Step 3: success ///////////////////////////////////////////////////////// private void WriteSuccessTextPanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { if (!String.IsNullOrEmpty(passwordRecovery.SuccessText)) { string className = (passwordRecovery.SuccessTextStyle != null) && (!String.IsNullOrEmpty(passwordRecovery.SuccessTextStyle.CssClass)) ? passwordRecovery.SuccessTextStyle.CssClass + " " : ""; className += "AspNet-PasswordRecovery-SuccessTextPanel"; WebControlAdapterExtender.WriteBeginDiv(writer, className, ""); WebControlAdapterExtender.WriteSpan(writer, "", passwordRecovery.SuccessText); WebControlAdapterExtender.WriteEndDiv(writer); } }
///////////////////////////////////////////////////////// // Step 1: user name ///////////////////////////////////////////////////////// /// <summary> /// Writes the failure panel. /// </summary> /// <param name="writer"> /// The writer. /// </param> /// <param name="passwordRecovery"> /// The password recovery. /// </param> /// <remarks> /// </remarks> private void WriteFailurePanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { if (String.IsNullOrEmpty(this.currentErrorText)) { return; } var className = (!String.IsNullOrEmpty(passwordRecovery.FailureTextStyle.CssClass)) ? passwordRecovery.FailureTextStyle.CssClass + " " : string.Empty; className += "AspNet-PasswordRecovery-FailurePanel"; WebControlAdapterExtender.WriteBeginDiv(writer, className, string.Empty); WebControlAdapterExtender.WriteSpan(writer, string.Empty, this.currentErrorText); WebControlAdapterExtender.WriteEndDiv(writer); }
private void WriteSubmitPanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { if ((_state == State.UserName) || (_state == State.UserLookupError)) { Control container = passwordRecovery.UserNameTemplateContainer; string id = (container != null) ? container.ID + "_Submit" : "Submit"; string idWithType = WebControlAdapterExtender.MakeIdWithButtonType("Submit", passwordRecovery.SubmitButtonType); Control btn = (container != null) ? container.FindControl(idWithType) as Control : null; if (btn != null) { Page.ClientScript.RegisterForEventValidation(btn.UniqueID); bool clientSubmit = (passwordRecovery.SubmitButtonType == ButtonType.Link); PostBackOptions options = new PostBackOptions(btn, "", "", false, false, false, clientSubmit, true, passwordRecovery.UniqueID); string javascript = "javascript:" + Page.ClientScript.GetPostBackEventReference(options); javascript = Page.Server.HtmlEncode(javascript); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-PasswordRecovery-UserName-SubmitPanel", ""); Extender.WriteSubmit(writer, passwordRecovery.SubmitButtonType, passwordRecovery.SubmitButtonStyle.CssClass, id, btn.UniqueID, passwordRecovery.SubmitButtonImageUrl, javascript, passwordRecovery.SubmitButtonText); WebControlAdapterExtender.WriteEndDiv(writer); } } else if ((_state == State.Question) || (_state == State.AnswerLookupError)) { Control container = passwordRecovery.QuestionTemplateContainer; string id = (container != null) ? container.ID + "_Submit" : "Submit"; string idWithType = WebControlAdapterExtender.MakeIdWithButtonType("Submit", passwordRecovery.SubmitButtonType); Control btn = (container != null) ? container.FindControl(idWithType) as Control : null; if (btn != null) { Page.ClientScript.RegisterForEventValidation(btn.UniqueID); bool clientSubmit = (passwordRecovery.SubmitButtonType == ButtonType.Link); PostBackOptions options = new PostBackOptions(btn, "", "", false, false, false, clientSubmit, true, passwordRecovery.UniqueID); string javascript = "javascript:" + Page.ClientScript.GetPostBackEventReference(options); javascript = Page.Server.HtmlEncode(javascript); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-PasswordRecovery-Question-SubmitPanel", ""); Extender.WriteSubmit(writer, passwordRecovery.SubmitButtonType, passwordRecovery.SubmitButtonStyle.CssClass, id, btn.UniqueID, passwordRecovery.SubmitButtonImageUrl, javascript, passwordRecovery.SubmitButtonText); WebControlAdapterExtender.WriteEndDiv(writer); } } }
public UserNameDefaultTemplate (PasswordRecovery _owner) { this._owner = _owner; }
public SuccessDefaultTemplate (PasswordRecovery _owner) { this._owner = _owner; }
public BasePasswordRecoveryContainer (PasswordRecovery owner) { _owner = owner; renderOuterTable = _owner.RenderOuterTable; if (renderOuterTable) InitTable (); }
public SuccessContainer (PasswordRecovery owner) : base (owner) { }
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); }
public BasePasswordRecoveryContainer (PasswordRecovery owner) { _owner = owner; #if NET_4_0 renderOuterTable = _owner.RenderOuterTable; if (renderOuterTable) #endif InitTable (); }
private void WriteAnswerPanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { Control container = passwordRecovery.QuestionTemplateContainer; TextBox textBox = (container != null) ? container.FindControl("Answer") as TextBox : null; RequiredFieldValidator rfv = (textBox != null) ? container.FindControl("AnswerRequired") as RequiredFieldValidator : null; string id = (rfv != null) ? container.ID + "_" + textBox.ID : ""; if (!String.IsNullOrEmpty(id)) { Page.ClientScript.RegisterForEventValidation(textBox.UniqueID); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-PasswordRecovery-AnswerPanel"); Extender.WriteTextBox(writer, false, passwordRecovery.LabelStyle.CssClass, passwordRecovery.AnswerLabelText, passwordRecovery.TextBoxStyle.CssClass, id, ""); WebControlAdapterExtender.WriteRequiredFieldValidator(writer, rfv, passwordRecovery.ValidatorTextStyle.CssClass, "Answer", passwordRecovery.AnswerRequiredErrorMessage); WebControlAdapterExtender.WriteEndDiv(writer); } }
public BasePasswordRecoveryContainer (PasswordRecovery owner) { _owner = owner; InitTable (); }
private void WriteFailurePanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { if (!String.IsNullOrEmpty(_currentErrorText)) { string className = (passwordRecovery.FailureTextStyle != null) && (!String.IsNullOrEmpty(passwordRecovery.FailureTextStyle.CssClass)) ? passwordRecovery.FailureTextStyle.CssClass + " " : ""; className += "AspNet-PasswordRecovery-FailurePanel"; WebControlAdapterExtender.WriteBeginDiv(writer, className); WebControlAdapterExtender.WriteSpan(writer, "", _currentErrorText); WebControlAdapterExtender.WriteEndDiv(writer); } }
/// <summary> /// Writes the submit panel. /// </summary> /// <param name="writer"> /// The writer. /// </param> /// <param name="passwordRecovery"> /// The password recovery. /// </param> /// <remarks> /// </remarks> private void WriteSubmitPanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { if ((this.state == State.UserName) || (this.state == State.UserLookupError)) { var container = passwordRecovery.UserNameTemplateContainer; var id = (container != null) ? container.ID + "_Submit" : "Submit"; var idWithType = WebControlAdapterExtender.MakeIdWithButtonType( "Submit", passwordRecovery.SubmitButtonType); var btn = (container != null) ? container.FindControl(idWithType) : null; if (btn != null) { this.Page.ClientScript.RegisterForEventValidation(btn.UniqueID); var options = new PostBackOptions( btn, string.Empty, string.Empty, false, false, false, true, true, passwordRecovery.UniqueID); var javascript = "javascript:" + this.Page.ClientScript.GetPostBackEventReference(options); javascript = this.Page.Server.HtmlEncode(javascript); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-PasswordRecovery-UserName-SubmitPanel", string.Empty); this.Extender.WriteSubmit( writer, passwordRecovery.SubmitButtonType, passwordRecovery.SubmitButtonStyle.CssClass, id, passwordRecovery.SubmitButtonImageUrl, javascript, passwordRecovery.SubmitButtonText); WebControlAdapterExtender.WriteEndDiv(writer); } } else if ((this.state == State.Question) || (this.state == State.AnswerLookupError)) { var container = passwordRecovery.QuestionTemplateContainer; var id = (container != null) ? container.ID + "_Submit" : "Submit"; var idWithType = WebControlAdapterExtender.MakeIdWithButtonType( "Submit", passwordRecovery.SubmitButtonType); var btn = (container != null) ? container.FindControl(idWithType) : null; if (btn != null) { this.Page.ClientScript.RegisterForEventValidation(btn.UniqueID); var options = new PostBackOptions( btn, string.Empty, string.Empty, false, false, false, true, true, passwordRecovery.UniqueID); var javascript = "javascript:" + this.Page.ClientScript.GetPostBackEventReference(options); javascript = this.Page.Server.HtmlEncode(javascript); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-PasswordRecovery-Question-SubmitPanel", string.Empty); this.Extender.WriteSubmit( writer, passwordRecovery.SubmitButtonType, passwordRecovery.SubmitButtonStyle.CssClass, id, passwordRecovery.SubmitButtonImageUrl, javascript, passwordRecovery.SubmitButtonText); WebControlAdapterExtender.WriteEndDiv(writer); } } }
/// <summary> /// Writes the instruction panel. /// </summary> /// <param name="writer"> /// The writer. /// </param> /// <param name="passwordRecovery"> /// The password recovery. /// </param> /// <remarks> /// </remarks> private void WriteInstructionPanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { if ((this.state == State.UserName) || (this.state == State.UserLookupError)) { if (!String.IsNullOrEmpty(passwordRecovery.UserNameInstructionText)) { var className = (!String.IsNullOrEmpty(passwordRecovery.InstructionTextStyle.CssClass)) ? passwordRecovery.InstructionTextStyle.CssClass + " " : string.Empty; className += "AspNet-PasswordRecovery-UserName-InstructionPanel"; WebControlAdapterExtender.WriteBeginDiv(writer, className, string.Empty); WebControlAdapterExtender.WriteSpan(writer, string.Empty, passwordRecovery.UserNameInstructionText); WebControlAdapterExtender.WriteEndDiv(writer); } } else if ((this.state == State.Question) || (this.state == State.AnswerLookupError)) { if (!String.IsNullOrEmpty(passwordRecovery.QuestionInstructionText)) { var className = (!String.IsNullOrEmpty(passwordRecovery.InstructionTextStyle.CssClass)) ? passwordRecovery.InstructionTextStyle.CssClass + " " : string.Empty; className += "AspNet-PasswordRecovery-Question-InstructionPanel"; WebControlAdapterExtender.WriteBeginDiv(writer, className, string.Empty); WebControlAdapterExtender.WriteSpan(writer, string.Empty, passwordRecovery.QuestionInstructionText); WebControlAdapterExtender.WriteEndDiv(writer); } } }
///////////////////////////////////////////////////////// // Step 1: user name ///////////////////////////////////////////////////////// private void WriteTitlePanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { if ((_state == State.UserName) || (_state == State.UserLookupError)) { if (!String.IsNullOrEmpty(passwordRecovery.UserNameTitleText)) { string className = (passwordRecovery.TitleTextStyle != null) && (!String.IsNullOrEmpty(passwordRecovery.TitleTextStyle.CssClass)) ? passwordRecovery.TitleTextStyle.CssClass + " " : ""; className += "AspNet-PasswordRecovery-UserName-TitlePanel"; WebControlAdapterExtender.WriteBeginDiv(writer, className, ""); WebControlAdapterExtender.WriteSpan(writer, "", passwordRecovery.UserNameTitleText); WebControlAdapterExtender.WriteEndDiv(writer); } } else if ((_state == State.Question) || (_state == State.AnswerLookupError)) { if (!String.IsNullOrEmpty(passwordRecovery.QuestionTitleText)) { string className = (passwordRecovery.TitleTextStyle != null) && (!String.IsNullOrEmpty(passwordRecovery.TitleTextStyle.CssClass)) ? passwordRecovery.TitleTextStyle.CssClass + " " : ""; className += "AspNet-PasswordRecovery-Question-TitlePanel"; WebControlAdapterExtender.WriteBeginDiv(writer, className, ""); WebControlAdapterExtender.WriteSpan(writer, "", passwordRecovery.QuestionTitleText); WebControlAdapterExtender.WriteEndDiv(writer); } } }
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); }
private void WriteUserPanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { if ((_state == State.UserName) || (_state == State.UserLookupError)) { Control container = passwordRecovery.UserNameTemplateContainer; TextBox textBox = (container != null) ? container.FindControl("UserName") as TextBox : null; RequiredFieldValidator rfv = (textBox != null) ? container.FindControl("UserNameRequired") as RequiredFieldValidator : null; string id = (rfv != null) ? container.ID + "_" + textBox.ID : ""; if (!String.IsNullOrEmpty(id)) { Page.ClientScript.RegisterForEventValidation(textBox.UniqueID); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-PasswordRecovery-UserName-UserPanel", ""); Extender.WriteTextBox(writer, false, passwordRecovery.LabelStyle.CssClass, passwordRecovery.UserNameLabelText, passwordRecovery.TextBoxStyle.CssClass, id, textBox.UniqueID, passwordRecovery.UserName); WebControlAdapterExtender.WriteRequiredFieldValidator(writer, rfv, passwordRecovery.ValidatorTextStyle.CssClass, "UserName", passwordRecovery.UserNameRequiredErrorMessage); WebControlAdapterExtender.WriteEndDiv(writer); } } else if ((_state == State.Question) || (_state == State.AnswerLookupError)) { WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-PasswordRecovery-Question-UserPanel", ""); Extender.WriteReadOnlyTextBox(writer, passwordRecovery.LabelStyle.CssClass, passwordRecovery.UserNameLabelText, passwordRecovery.TextBoxStyle.CssClass, passwordRecovery.UserName); WebControlAdapterExtender.WriteEndDiv(writer); } }
private Boolean SendMail(PasswordRecovery objPasswordRecovery) { bool mailSent = true; MailMessage objMsg = null; Hashtable hsTableMailInfo = new Hashtable(); SmtpClient smtpClient = new SmtpClient(); hsTableMailInfo["ext:PosswordRecovery"] = objPasswordRecovery; String templatePhysicalPath = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, @"Views\Shared\Templates\Email\"); objMsg = new MailMessage(); objMsg.From = new MailAddress(ConfigurationManager.AppSettings[PageConstants.FromAddress], ConfigurationManager.AppSettings[PageConstants.FromDisplayName], Encoding.UTF8); objMsg.To.Add(objPasswordRecovery.EmailId); objMsg.Subject = "Your lost password"; objMsg.SubjectEncoding = Encoding.UTF8; objMsg.Body = Utility.TransformXsltToXhtml(templatePhysicalPath, "PasswordRecovery.xslt", hsTableMailInfo); objMsg.BodyEncoding = Encoding.UTF8; objMsg.IsBodyHtml = true; objMsg.Priority = MailPriority.High; try { smtpClient.Credentials = new NetworkCredential(ConfigurationManager.AppSettings[PageConstants.SmtpUserName], ConfigurationManager.AppSettings[PageConstants.SmtpPassword]); smtpClient.Host = ConfigurationManager.AppSettings[PageConstants.SmtpHost]; smtpClient.Port = int.Parse(ConfigurationManager.AppSettings[PageConstants.SmtpPort]); smtpClient.EnableSsl = true; smtpClient.Send(objMsg); mailSent = true; } catch (Exception) { //mailSent = false; } return mailSent; }
public QuestionContainer (PasswordRecovery owner) : base (owner) { }
protected void ForgotPasswordWizard_NextButtonClick(object sender, WizardNavigationEventArgs e) { string temp = string.Empty; string result = string.Empty; txtSeqQusAns.Focus(); ForgotPasswordWizard.HeaderText =" "+ " (" + ForgotPasswordWizard.ActiveStep.Title + ")"; switch (ForgotPasswordWizard.WizardSteps[e.CurrentStepIndex].ID) { case "wizardStep1": lblUserNameRequire.Text = temp; lblEmailIdRequire.Text = temp; string UserName = txtUserName.Text.Trim(); string EmailId = txtEmailId.Text.Trim(); if (string.IsNullOrEmpty(UserName) && string.IsNullOrEmpty(EmailId)) result += "Required <br />"; if (string.IsNullOrEmpty(result)) { DataTable dt = objAuthorizationDal.CheckEmailId(txtEmailId.Text.Trim(), txtUserName.Text.Trim()); if (dt != null && dt.Rows.Count > 0) { lblEmailIdNotValid.Visible = false; EmailId = dt.Rows[0]["EMP_EMAIL"].ToString(); lblSeqQusFetch.Text = dt.Rows[0]["SECURITY_QUESTION_DESC"].ToString(); SecurityAnswer = dt.Rows[0]["SECURITY_ANSWERS"].ToString(); objPasswordRecovery = new PasswordRecovery(); objPasswordRecovery.UserName = dt.Rows[0]["USER_NAME"].ToString(); objPasswordRecovery.UserId = Convert.ToInt32(dt.Rows[0]["USER_ID"]); objPasswordRecovery.EmailId = dt.Rows[0]["EMP_EMAIL"].ToString(); lblSeqQusEmailIdFatch.Text = EmailId.ToString(); } else { if (lblSeqQusEmailIdFatch.Text == string.Empty || lblGetUsernameFetch.Text == string.Empty) { lblEmailIdRequire.Text = string.Empty; lblEmailIdNotValid.Text = "Invalid Username or Email Id."; e.Cancel = true; } } } else { // lblUserNotValid.Text = string.Empty; lblEmailIdNotValid.Text = string.Empty; //lblUserNameRequire.Text = "Required"; lblEmailIdRequire.Text = "Required Username or Emial Id"; e.Cancel = true; } break; case "wizardStep2": lblSeqAnsRequire.Text = temp; if (string.IsNullOrEmpty(txtSeqQusAns.Text)) result += "Required <br />"; if (string.IsNullOrEmpty(result)) { if (SecurityAnswer.Equals(txtSeqQusAns.Text.Trim())) { if (objPasswordRecovery != null) { string password = Utility.GetRandomPassword(6); if (!String.IsNullOrEmpty(password)) { objPasswordRecovery.Password = password; if (SendMail(objPasswordRecovery)) objAuthorizationDal.ResetUserPassword(objPasswordRecovery.UserId, objPasswordRecovery.Password); } } } else { lblSeqAnsRequire.Text = string.Empty; lblSeqAnsRequire.Text = "Incorrect answer."; e.Cancel = true; } } else { lblSeqAnsRequire.Text = string.Empty; lblSeqAnsRequire.Text = "Required"; e.Cancel = true; } break; case "wizardStep3": break; } }
public UserNameContainer (PasswordRecovery owner) : base (owner) { }
private void WriteHelpPanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { if ((!String.IsNullOrEmpty(passwordRecovery.HelpPageIconUrl)) || (!String.IsNullOrEmpty(passwordRecovery.HelpPageText))) { WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-PasswordRecovery-HelpPanel", ""); WebControlAdapterExtender.WriteImage(writer, passwordRecovery.HelpPageIconUrl, "Help"); WebControlAdapterExtender.WriteLink(writer, passwordRecovery.HyperLinkStyle.CssClass, passwordRecovery.HelpPageUrl, "Help", passwordRecovery.HelpPageText); WebControlAdapterExtender.WriteEndDiv(writer); } }
public QuestionDefaultTemplate (PasswordRecovery _owner) { this._owner = _owner; }
///////////////////////////////////////////////////////// // Step 2: question ///////////////////////////////////////////////////////// private void WriteQuestionPanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-PasswordRecovery-QuestionPanel", ""); Extender.WriteReadOnlyTextBox(writer, passwordRecovery.LabelStyle.CssClass, passwordRecovery.QuestionLabelText, passwordRecovery.TextBoxStyle.CssClass, passwordRecovery.Question); WebControlAdapterExtender.WriteEndDiv(writer); }
public static PasswordRecovery CreateTestControl (Page p) { LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG); LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG); PasswordRecovery w = new PasswordRecovery (); w.ID = "PasswordRecovery1"; p.Form.Controls.Add (lcb); p.Form.Controls.Add (w); p.Form.Controls.Add (lce); return w; }
///////////////////////////////////////////////////////// // Step 3: success ///////////////////////////////////////////////////////// /// <summary> /// Writes the success text panel. /// </summary> /// <param name="writer"> /// The writer. /// </param> /// <param name="passwordRecovery"> /// The password recovery. /// </param> /// <remarks> /// </remarks> private static void WriteSuccessTextPanel(HtmlTextWriter writer, PasswordRecovery passwordRecovery) { if (String.IsNullOrEmpty(passwordRecovery.SuccessText)) { return; } var className = (!String.IsNullOrEmpty(passwordRecovery.SuccessTextStyle.CssClass)) ? passwordRecovery.SuccessTextStyle.CssClass + " " : string.Empty; className += "AspNet-PasswordRecovery-SuccessTextPanel"; WebControlAdapterExtender.WriteBeginDiv(writer, className, string.Empty); WebControlAdapterExtender.WriteSpan(writer, string.Empty, passwordRecovery.SuccessText); WebControlAdapterExtender.WriteEndDiv(writer); }