Jump to:

23001 Posts in 11854 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » Password Protect a Page

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2390 Views
  • mhull
    Avatar
    Community Member
    79 Posts

    Password Protect a Page Link to this post

    How to I password protect a page?
    If a client goes to a certain page, I want a log in form to show, so when they log in they will be able to see that page. How do I do this?

    I can see "logged in users can view this page" under the access tab but this hides the page and doesnt show the log in form.
    I have seen Arams article on SSBits on Custom Login Form with Group Based Redirection. But this doesnt seem to answer my problem either.

    I am looking to use this with the Filesharing module.

  • Fuzz10
    Avatar
    Community Member
    786 Posts

    Re: Password Protect a Page Link to this post

    Set the correct values under the "Access tab" --> only these people (Choose from list)..

  • mhull
    Avatar
    Community Member
    79 Posts

    Re: Password Protect a Page Link to this post

    This hides the page, I dont want the page hidden, I want there to be a log in page.

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: Password Protect a Page Link to this post

    Try leaving the Page you want to be password protected as "only accessible by logged-in users" then setup another Virtual Page that sends to it. Then users will be able to see the Virtual page if they are not logged in and clicking on it will force a login on the way to the other page. You might have to do some custom work to you Navigation to hide that Virtual Page once logged in.

    Alternatively you could create a Top Level page that is not password protected and put the page with protected content and accessibility limited to logged in users under it in the hierarchy. Then you just have to make it pretty.

  • mhull
    Avatar
    Community Member
    79 Posts

    Re: Password Protect a Page Link to this post

    Okay, a little play, and I think what I could do is:

    The page that I want password protected, make viewable only to logged in users. Dont show in menus, or in search.

    Then make this a child of a redirector page, that is viewable to everyone, therefore showing in the menu, and a log in page when clicked on.

    Looks to work, but hope there is a better way. Anyone have a better answer

    Thanks for your reply dalesaurus

  • socks
    Avatar
    Community Member
    190 Posts

    Re: Password Protect a Page Link to this post

    If the issue is that you need the password protected page to always show up in the main menu, you could probably just hard code the link into the template. Or link to it somewhere else in the design.

    <ul>
       <% control Menu(1) %>   
          <li><a href="$Link" class="$LinkingMode">$MenuTitle</a></li>
       <% end_control %>
    <li><a href="password-protected-page" class="$LinkingMode">Client Page</a></li>
    </ul>

    2390 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.