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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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

Ever locked yourself out?


Go to End


3 Posts   1212 Views

Avatar
dalesaurus

Community Member, 283 Posts

19 August 2009 at 4:05am

I did and I thought I'd throw up my solutions for some further search options. This assumes you have access to your webserver to use some PHP code.

Option 1 - Set a Global Login
From: http://doc.silverstripe.com/doku.php?id=security#system_configuration

In your _config.php

Security::setDefaultAdmin($username, $password)

Option 2 - Use the Environment Configuration file
From: http://doc.silverstripe.com/doku.php?id=environment-management

At the top level of your site folder create _ss_environment.php

define('SS_DEFAULT_ADMIN_USERNAME', 'username');
define('SS_DEFAULT_ADMIN_PASSWORD', 'password');

Option 3 - Using a Member DataObject
In some page controller, config, or any interpreted php file:

$m = DataObject::get_one('Member', "Email = 'your@email.com'");
$m->changePassword('newpass');

All of these can get the job done. If you were thinking about trashing around the database and changing the hashes yourself I would recommend against it. SilverStripe uses salted SHA1 encryption which is no fun to try and create yourself just to overwrite in multiple tables.

Avatar
Taffy

Community Member, 119 Posts

19 August 2009 at 9:15pm

Edited: 19/08/2009 9:16pm

Hi Dalesaurus. That'll be very useful to users. Are you aware of http://ssbits.com/ ? Might be a good place to put your mini tutorial.

Avatar
Romeo

Community Member, 67 Posts

20 August 2009 at 1:41am

Very useful, thanks - I needed it just now. The strange thing was that Silverstripe no longer recognised my existing password as valid - I was not entering the wrong one. I wonder whether I accidentally changed it while installing another Silverstripe app on the same server (even though I didn't use the 'SS_mysite' database, I specified another).