Username/Password in .env file rejected as "invalid"

A client’s site was migrated to another hosting company, and the sender will not provide the site login info. Instead, they instructed me to create a new login manually.
When I tried to sign in using the existing username and password in the .env file, and when I changed to new credentials, I received an “invalid” error message.

How do I remedy this?

Can you provide any more information? It’s hard to know from that description. Are you adding the new user in .env with the SS_DEFAULT_ADMIN_* variables?

What environment are you running on? Some environments (eg Docker) might need you to restart the containers for ENV variables to be updated.

Thanks for your response, Tim. Unfortunately, I do not know the environment because I cannot access the dashboard.

My longtime U.S.-based client just migrated their website back here from the UK. I have been their communications consultant for more than a decade, and designed their site back when they launched, so they naturally assigned me the task of post-migration content updates.

They moved it to the UK in the WordPress environment; it returned as a beautiful SilverStripe site.
This is my first encounter with SilverStripe, and the more I learn about it, the more I love it! However, I am unable to log in to the client’s SilverStripe site, and the UK developer instructed me to manually configure a new login because he cannot access the dashboard with his old login credentials now that it is no longer on his server.

Either he updated this site for years without recording the login information, or, unlike other CMS platforms, users cannot log in universally from the front end, using the existing username and password.

Following the SilverStripe tutorial, I opened the .env file and saw the default username and password. Those credentials were rejected as “invalid” on the sign-in page. Concluding that the reason was that the sign-in page requested an email address, I returned to the UK-based developer and asked for the email address used previously. (I had tried using his, and it did not work.)

He said I could use a username instead of an email address, but that did not resolve the problem. I even changed the username and password in the ENV file, and that did not open the door.

Even if I knew how to restart the containers so the ENV variables would update, that would not explain why using the username and password from that migrated file did not work.

What am I misunderstanding here?

Thanks,

Pat

Which version of SilverStripe are you using?
I just tried this with a version 4.13 and a version 6.1, both worked flawless.

I used these variables in the .env file:

SS_DEFAULT_ADMIN_USERNAME=“admin”
SS_DEFAULT_ADMIN_PASSWORD=“password”

I could …

  • sign in with a made-up username
  • sign in with an existing e-mail (Member table) overriding the password

Be aware that there also might be environment specific .env files
like
.env.dev
.env.test

So depending on your current environment setting you have to use the matching .env-file.

OK, I’m a little confused by the situation here, so it might be worth getting some terminology clear. You’re talking about “front end” logins and a dashboard, and you’re also mentioning the env file.

You are correct in saying that “unlike other CMS platforms, users cannot log in universally from the front end”. Silverstripe has a powerful permissions system which grants different users varying levels of access, and how that works will depend on how the site was developed.

For now, my terminology is:
“Front end” - the actual website that normal visitors see
”CMS” - the admin pages of the site where you manage content, etc.

So, for now, I’m going to assume you’re trying to log into the actual CMS (eg. example.com/admin) rather than some kind of protected page of the front-end website.

There is no reason the credentials for CMS access would have changed when the site was migrated, other than someone removed them from the system. All those credentials are stored in the database, so they should have come along with the rest of the site.

Setting the SS_DEFAULT_ADMIN_* variables as described in this thread should allow you access to the CMS. You don’t have to use an email… just a username and password.

If that isn’t working, then it could be something to do with the new hosting environment. It may not be reading the env file, it may need to be refreshed, etc. and you may need to talk to a developer or your hosting provider for assistance.

If my assumptions are wrong, and you’re not trying to log into the CMS, but into another part of the site, let us know and we can try to help with that.

One last (important) note: If you use the default admin username and password in the env, please be sure to set up a proper user in the ‘Security’ section of the CMS and remove the defaults from the env as soon as possible - they should only ever be used for development environments / emergencies

You two have been GREAT!

Thanks so much,

Pat