1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / ChangePasswordForm design mode exception

ChangePasswordForm design mode exception

2 posts, 0 answered
  1. Pablo
    Pablo avatar
    12 posts
    Registered:
    09 Dec 2010
    16 Jan 2011
    Link to this post
    Hi,
    After creating a new project, adding a page with a Telerik.Sitefinity.Security.Web.UI.ChangePasswordForm control I get a System.IndexOutOfRangeException when trying to edit the page again. When I first added the control, it had the DisplayUserName property in False, but it shows the field anyway.
    I need to provide my Front end users the ability to change their passwords. Any suggestions?
    Thanks in advance
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    17 Jan 2011
    Link to this post
    Hello Pablo,

    Thanks a lot for reporting this issue. To workaround the exception, you could create your own control overriding Telerik.Sitefinity.Security.Web.UI.ChangePasswordForm like this:

    using Telerik.Sitefinity.Security.Web.UI;
    using System.Web.UI;
     
    namespace SitefinityWebApp
    {
        public class CustomChangePasswordForm : ChangePasswordForm
        {
            protected override void CreateChildControls()
            {
                base.CreateChildControls();
                var changePasswordContainer = this.FindControl("ChangePasswordContainerID") as ChangePasswordContainer;
                if (changePasswordContainer != null)
                {
                    changePasswordContainer.UserNameTextBox.Visible = this.DisplayUserName;
                    var userNameLabel = changePasswordContainer.FindControl("UserNameLabel");
                    if(userNameLabel != null)
                        userNameLabel.Visible = this.DisplayUserName;
                }
            }
     
            protected override object SaveViewState()
            {
                object[] objArray = new object[] { null, (this.MailDefinition != null) ? ((IStateManager)this.MailDefinition).SaveViewState() : null };
                for (int i = 0; i < objArray.Length - 1; i++)
                {
                    if (objArray[i] != null)
                    {
                        return objArray;
                    }
                }
                return null;
            }
        }
    }

    The problem will be fixed in the next release.

    Kind regards,
    Pepi
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered