Customising Login Form SS4

Silverstripe 4.0

Hi, Im trying to override the Silverstripe login for page, I have created a file called Security_login.ss into my themes folder the way you do normally in SS3, and I call the form in by $LoginForm.

The page works fine and custom template loads in, but when I actually try and login it gives a 404 page.

The form actions look different from the $LoginForm and the default silverstripe login form, the $LoginForm action is "/Security/LoginForm/’ but the default login action is “/Security/login/default/LoginForm/”

Any help would be much appreciated.

Regards

Anish

Hi Anish, can we get a bit more detail on what you’re trying to do - are you only overriding the template or are you using a different controller as well? Please post any code you’re using so we can try to see what’s happening.

Hi Jono

I’m literally trying to override the login template so its just a blank screen with the $LoginForm.

This is what my security_login.ss looks like:

<!DOCTYPE html>

<html>
<head>
<meta charset=“utf-8”>
<meta http-equiv=“X-UA-Compatible” content=“IE=edge”>
<title>Login to $SiteConfig.Title</title>
<meta name=“viewport” content=“width=device-width, initial-scale=1”>
<link rel=“stylesheet” href="$BaseHref/gostripe/css/gostripe.css">
</head>
<body>
<!–[if lt IE 7]>
<p class=“browsehappy”>You are using an <strong>outdated</strong> browser. Please <a href=“http://browsehappy.com/”>upgrade your browser</a> to improve your experience.</p>
<![endif]–>
<style type=“text/css”>
body{ font-family:sans-serif;}
fieldset{ border:0;}
</style>

<div id=“goStripeLoginForm”>
<img src="$BaseHref/gostripe/images/shapelogo.png" style=“margin:2em auto; display:block;” />
$LoginForm
</div>

</body>
</html>

I tried this out and got the same issue, dug a little deeper and it seems you need to use $Form instead of $LoginForm. I can’t remember if it was the same in SS3 or not but changing that fixed the issue for me. I also noticed you don’t have a <% base_tag %> in your head section, doesn’t seem to be a big problem in this case but SilverStripe does expect that tag to be present.