Is there a way to reset the password for user id -1?
I have seen admin password reset on v7 but nothing on v8.
I am stuck with a non-working password.
How can I avoid this when I need to move the website?
A couple of things... you may not be able to login after the move of your site, if your site can't connect to your database - are you using a separate SQL server or SQL CE?, and if using SQL Server, has your database moved too? and can your new site location connect successfully to the database?
Secondly, the password is stored as a hash in the database, in theory, the hash algorithm type, used to generate this has 'could' be different between environments, particularly if a different version of the .net framework is used for the site. There is a detailed explanation here:
Ok, thanks. I will try this when I get a chance. I reinstalled it on the new machine and copied all the models, controllers, partial views, templates and document types. I also had to add the Members changes (added fields like First Name, Last Name, Address 1 + 2, City, State (dropdown with all 50+ states), Zip Code and Phone. Wasn't fun but wasn't impossible. Good thing I am setting up a new website and I didn't have any members yet. When I get a chance, I will backup the existing website and database, then I will restore the old backups and try this and report back that way we can have a post with a solution.
I have the exact same problem. Moved the site from my local machine to Azure , the site is up and running but I cannot log in to the back-end. Tried the steps above but didn't work for me.
Does anyone have an idea on how to get it to work?
Fixed it locally and on Azure. I tried a number of approaches, sending email, using the admin password reset dll, and a number fo SQL statements. All on Umbraco 8.5.3
Nothing worked but the email looked like it may have if I kept going.
I then decided to add a user programmatically using this:
private void CreateUser()
{
// Create a new user
string email = "[email protected]";
var newUser = Services.UserService.CreateUserWithIdentity(email, email);
// Get user group as IReadOnlyUserGroup
var userGroup = Services.UserService.GetUserGroupByAlias("admin") as IReadOnlyUserGroup;
// Add the userGroup to the newUser
newUser.AddGroup(userGroup);
// Set the user's password
string password = "ASd$%fHJ!";
newUser.RawPasswordValue = (Membership.Providers["UsersMembershipProvider"] as UsersMembershipProvider).HashPasswordForStorage(password); ;
// Save the new user
Services.UserService.Save(newUser);
}
And this did give me another admin user!
Very hacky but I got back in.
I can't see the original admin user but will clean that up later when I get emails working.
Moved site now I can't login, invalid password
Is there a way to reset the password for user id -1? I have seen admin password reset on v7 but nothing on v8. I am stuck with a non-working password. How can I avoid this when I need to move the website?
Hi Edgar
A couple of things... you may not be able to login after the move of your site, if your site can't connect to your database - are you using a separate SQL server or SQL CE?, and if using SQL Server, has your database moved too? and can your new site location connect successfully to the database?
Secondly, the password is stored as a hash in the database, in theory, the hash algorithm type, used to generate this has 'could' be different between environments, particularly if a different version of the .net framework is used for the site. There is a detailed explanation here:
https://shazwazza.com/post/umbraco-passwords-and-aspnet-machine-keys
...but I think in V8 the 'hash algorithm' used for the password is also stored in the database for each user, so this shouldn't be an issue!
Finally in V8 the UserLogin and UserPassword details are still stored in the database, so executing the following SQL against the db:
will allow you to find your -1 user, and check if they are locked out...
You can then update this row in the db accordingly with an UPDATE statement
for example:
should reset the login to be: (perform a site restart/application pool recycle first)
UserName: [email protected] Password: abc123abc123
regards
Marc
Ok, thanks. I will try this when I get a chance. I reinstalled it on the new machine and copied all the models, controllers, partial views, templates and document types. I also had to add the Members changes (added fields like First Name, Last Name, Address 1 + 2, City, State (dropdown with all 50+ states), Zip Code and Phone. Wasn't fun but wasn't impossible. Good thing I am setting up a new website and I didn't have any members yet. When I get a chance, I will backup the existing website and database, then I will restore the old backups and try this and report back that way we can have a post with a solution.
Thank you for your time.
I ended up reinstalling it. Never had a chance to test this, sorry, and thank you for your help.
I have the exact same problem. Moved the site from my local machine to Azure , the site is up and running but I cannot log in to the back-end. Tried the steps above but didn't work for me.
Does anyone have an idea on how to get it to work?
Would love to know the answer to this I have the same problem
Petras this has got me out of jail a few times.
https://our.umbraco.com/packages/developer-tools/umbraco-admin-reset/
HTH
Steve
Ah - actually you want to read the solution on this thread!
https://our.umbraco.com/forum/using-umbraco-and-getting-started/100915-can-not-login-in-umbraco-backoffice-after-deployment-on-production
Fixed it locally and on Azure. I tried a number of approaches, sending email, using the admin password reset dll, and a number fo SQL statements. All on Umbraco 8.5.3
Nothing worked but the email looked like it may have if I kept going.
I then decided to add a user programmatically using this:
And this did give me another admin user! Very hacky but I got back in. I can't see the original admin user but will clean that up later when I get emails working.
is working on a reply...