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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

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

Customising member login form

Go to End

2 Posts   2624 Views


Community Member, 63 Posts

15 November 2010 at 5:45pm

Hi. I'm trying to find a way to customise the login bit for members-only pages on a website I'm building.
What I want to do is this:
- change the 'email' label on login to 'username'
- remove the 'lost password' link
- add a link for 'change password' that gets displayed once a user is logged in.

I tried changing the 'email' label to 'username' in sapphire/security/MemberLoginForm.php but all I managed to do was make the login form not work at all.
As far as I can tell all the code for the things I want to do is in MemberLoginForm.php but I'm not sure which bits exactly to edit, I'm still pretty new to php, still getting the hang of it.
Can anyone tell me how to go about making the login form work how i want it?



Community Member, 78 Posts

16 November 2010 at 6:06am


perhaps the following helps.

create a custom class that extends MemberLoginForm :

For example:

class MyCustomLoginForm extends MemberLoginForm {

    public function  __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true) {

        $fields = new FieldSet(
                new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this),
                //Regardless of what the unique identifer field is (usually 'Email'), it will be held in the 'Email' value, below:
                new TextField("Email", $label, Session::get('SessionForms.MemberLoginForm.Email'), null, $this),
                new PasswordField("Password", _t('Member.PASSWORD', 'Password'))
        if(Security::$autologin_enabled) {
                $fields->push(new CheckboxField(
                        _t('Member.REMEMBERME', "Remember me next time?")

        parent::__construct($controller, $name, $fields, $actions, $checkCurrentUser);


you can add custom fields to the fieldset .....

then put into your _config.php

Object::useCustomClass('MemberLoginForm', 'MyCustomLoginForm');