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

Forums / Security / Login Control Visibility

Login Control Visibility

2 posts, 0 answered
  1. Steve
    Steve avatar
    11 posts
    Registered:
    18 Dec 2008
    17 Sep 2009
    Link to this post
    There are two settings in the Login Control that are accessible by the administrator; both seem not to work.  The first is the DisplayRememberMe setting.  Toggling this setting to True or False does not change the control display; why?  (We would like to remove this field from the login control.)

    The second has to do with visibility of the login control itself.  Before updating to v3.7 the VisibleWhenLoggedIn property worked, now setting this property to T or F does not impact the control visibility.  What could have changed?

    Steve
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Sep 2009
    Link to this post
    Hello Steve,

    1.There are two settings in the Login Control that are accessible by the administrator; both seem not to work.  The first is the DisplayRememberMe setting.  Toggling this setting to True or False does not change the control display; why?  (We would like to remove this field from the login control.)


     To fix the first issue remove the LayoutTemplate from the control. The control is located under
    ~/Sitefinity/UserControls/Login/LoginControl.ascx.cs

    Another option is extending the control and adding a new boolean property which will hide or show the checkbox. Below is sample implementation.

    using System; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using System.ComponentModel; 
     
    public partial class UserControls_FinalLoginControls_LoginControl : UserControl 
        void Page_Load(object sender, EventArgs e) 
        { 
     
            CheckBox rememberMe = this.FindControlRecursive(Login1, "RememberMe"as CheckBox; 
            if (!displayRM) 
            { 
                rememberMe.Visible = false
            } 
        } 
     
        public Login Login 
        { 
            get 
            { 
                return this.Login1; 
            } 
            set 
            { 
                this.Login1 = value; 
            } 
        } 
        [DefaultValue(true)] 
        public bool DisplayRememberMe 
        { 
            get 
            { 
                return this.displayRM; 
     
            } 
            set 
            { 
                this.displayRM = value; 
            } 
        } 
        private bool displayRM = true
     
     
        private Control FindControlRecursive(Control root, string id) 
        { 
            if (root.ID == id) 
            { 
                return root; 
            } 
     
            foreach (Control c in root.Controls) 
            { 
                Control t = FindControlRecursive(c, id); 
                if (t != null
                { 
                    return t; 
                } 
            } 
     
            return null
        }  
     
     
     
     

    2.The second has to do with visibility of the login control itself.  Before updating to v3.7 the VisibleWhenLoggedIn property worked, now setting this property to T or F does not impact the control visibility.  What could have changed?


     I am not able to reproduce this problem. Please take a look at the attached video.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered