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

Forums / General Discussions / SF 5.2, private/public pages setup

SF 5.2, private/public pages setup

4 posts, 0 answered
  1. Olivier
    Olivier avatar
    31 posts
    Registered:
    06 Aug 2012
    04 Dec 2012
    Link to this post
    Hi.
    Hopefully someone can point me in the right direction.  If you have even part of an answer, please reply with that part - at least I will have something to start off with.

    We have SiteFinity 5.2 installed, and we need to have a public and a secured section.
    Here are our requirements :
    - Login / Logoff controls, with proper "Welcome xyz" type message - I believe there are widgets for this;
    - Login form only visible when the user is not logged in;
    - Request for a password reset found this for proper setup http://www.sitefinity.com/devnet/kb/configuring-password-recovery-in-sitefinity);
    - If a person tries to access a secured page directly, show a custom login page, not the Sitefinity default one;
    - Display a Menu based on the site map that would display/hide entries based on when you are logged on/off.
    This may sound like obvious to some of you, but I can't seem to find the exact right way to achieve this, specialy with the line in bold above.
    Thanks for your help!
  2. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    Registered:
    04 Jan 2016
    10 Dec 2012
    Link to this post
    Hi,

    Thank you for using our services.

    1. You can use the login name widget and customize the message string to display "Welcome, FirstName LastName" instead of only the name of the user:http://screencast.com/t/drLiVW8AuLIV
    In addition, you can use the Login/Logout button which will change depending on the status of the user:http://screencast.com/t/Cl9XY1q0. For the Login/Logout button you need to configure the login and logout urls. You can find more information here:Configuring the Login status widget

    2. This is not available out of the box. You can create a dedicated login page(not available in the navigation) with the Login control in it. When a user clicks on the Login button or tries to access a page that requires authentication, he will be redirected to the login page.

    3. You can also take a look at this article:Configuring the password recovery

    4. The Sitefinity login will be shown only if that user has backend access, frontend users will never be taken to the /Sitefinity login page. One of the ways to secure a frontend page is to restrict the access to only a specific Role. That way when an anonymous users tries to access it, you will be able to intercept the event in the Global.asax and redirect to your custom login page. Here is a small sample how this is done in the Global.asax:

    using System;
    using System.Linq;
    using Telerik.Sitefinity.Abstractions;
    using Telerik.Sitefinity.Services;
    using Telerik.Sitefinity.Web.Events;
      
    namespace SitefinityWebApp
    {
        public class Global : System.Web.HttpApplication
        {
      
            protected void Application_Start(object sender, EventArgs e)
            {
                Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
            }
      
            void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
            {
                EventHub.Subscribe<IUnauthorizedPageAccessEvent>(new Telerik.Sitefinity.Services.Events.SitefinityEventHandler<IUnauthorizedPageAccessEvent>(OnUnauthorizedAccess));
            }
      
            void OnUnauthorizedAccess(IUnauthorizedPageAccessEvent unauthorizedEvent)
            {
                var url = unauthorizedEvent.Page.Url.TrimStart('~');
                if (unauthorizedEvent.Page.Title.Contains("pp"))
                    unauthorizedEvent.HttpContext.Response.Redirect("~/p1");
                else
                    unauthorizedEvent.HttpContext.Response.Redirect("~/");
            }
      
            protected void Session_Start(object sender, EventArgs e)
            {
      
            }
      
            protected void Application_BeginRequest(object sender, EventArgs e)
            {
      
            }
      
            protected void Application_AuthenticateRequest(object sender, EventArgs e)
            {
      
            }
      
            protected void Application_Error(object sender, EventArgs e)
            {
      
            }
      
            protected void Session_End(object sender, EventArgs e)
            {
      
            }
      
            protected void Application_End(object sender, EventArgs e)
            {
      
            }
        }
    }

    You should be able to easily extend this to fit your scenario.
     
    5. By default if you use the default navigation, you can filter by permissions and it will show only the pages the user can access. Once he is authenticated, the pages he had no access to as Anonymous will be added to the navigation as well. You can check if filtering by view permissions ins enabled by going to Settings -> Advanced -> Security: FilterQueriesByViewPermissions.

    I hope the information is helpful. If you have further more specific questions to your scenario, feel free to open a support ticket and we will be glad to assist you.

    Kind regards,
    Atanas Valchev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Olivier
    Olivier avatar
    31 posts
    Registered:
    06 Aug 2012
    12 Dec 2012
    Link to this post
    Thanks for the information.
    I believe the Telerik.Sitefinity.Web.Events namespace is only available starting SF 5.2 because I had issues with a 5.1 not finding it.  I will give this a try - thansk!

    BTW, can you tell me where you get these sample code from?  Is this somewhere available on the NET?
    Thanks.
  4. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    Registered:
    04 Jan 2016
    15 Dec 2012
    Link to this post
    Hi,

     We create them when helping clients and maintain an internal code sample repository. That way we can easily access them if we encounter a similar case in the future.

    Kind regards,
    Atanas Valchev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
4 posts, 0 answered