How to log into SilverStripe if you've lost the login details

Posted in SilverStripe -

If you have lost the admin login details for a SilverStripe installation and sending an email to reset the password is not working, there is a default admin account that can be enabled. After logging in, reset the regular administrator's details and then remove the temporary login as shown in this post.

I've since found basically the same post at SSBits.com... could have saved myself writing this post by just creating a bookmark to it :) I'll make sure to have a good read through their site before creating new SilverStripe posts here.

Enable a temporary administrator account in SilverStripe

To enable a temporary administrator account in SilverStripe add the following line of code to the mysite/_config.php file:

Security::setDefaultAdmin('admin', 'password');

You will want to change the example login name ('admin') and password ('password') to something not so obvious, even though it's only going to be active for a short time.

Log into the SilverStripe CMS and reset the existing admin login

After modifying the config file and uploading it to your SilverStripe installation, go to http://yourdomain/admin where "yourdomain" is your domain name and log in using these temporary login details.

Next select "Security" from the top menu and then the appropriate type under "Security Groups" - usually "Administrators". Now click the edit icon next to the user to edit. An inline window will appear with the user details. Click "Change Password" to change the password and then "Save" to save the changes.

Remove the temporary login

You can now log out and log back in again as the admin user that you've just reset. The only thing left to do is to remove the Security::setDefaultAdmin() line from your _config.php file and upload it again. Now the default admin user is gone and you cannot log in as that "user" again.




Comments