Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

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

Password Protect a Page

Go to End

6 Posts   3778 Views


Community Member, 79 Posts

13 August 2009 at 9:16pm

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.


Community Member, 791 Posts

14 August 2009 at 2:55am

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


Community Member, 79 Posts

14 August 2009 at 3:17am

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


Community Member, 283 Posts

14 August 2009 at 6:33am

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.


Community Member, 79 Posts

14 August 2009 at 7:19am

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


Community Member, 191 Posts

31 August 2009 at 7:32pm

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.

 	<% 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>