14 February 2010 at 4:51am
I am pretty new to SilverStripe. I converted my own HTML Template to a set of SilverStripe Templates. So far it was pretty easy.
Now I did encounter one problem. When I call the admin page I get the Login form, but when I enter my credentials and click login I get redirected to an empty page and when I open the admin page again, I am asked again to login.
What did I forget to do in my Templates, so that login will work?
15 February 2010 at 10:17am
i'm seeing the same exact thing and the problem is that the action attribute for the form tag is:
(notice the missing leading slash)
now... i tried in my Layouts/Page.ss to include: $LoginForm -- which fixes this (the action attribute is: /Security/LoginForm), but has the very bad side effect of including the login form on every single page (very bad)
15 February 2010 at 10:43am
so i came up with a hack-ish "fix" for this. In my: [theme]/Layout/Page.ss i have this little snippet of code:
<% if URLSegment == Security %>
<% end_if %>
Basically this uses the $LoginForm (which has the correct form action attribute) but will only include that on the Security/login page. Not great, and i'm sure the silverstripe folks will have something significantly better than this, but it got me around the problem.