Locked out of nopCommerce? Reset Your nopCommerce Administrator Account

Ray Huang Here’s the scenario: You’ve entered the login to your nopCommerce administrator account a hundred times before, but for some reason today, the information just eludes you.  You have some important information you need to update on the site. Maybe your boss is screaming at you or deadlines are looming, and panic starts to creep in.  No need to fret.  This article will show you how you can easily regain access to your site and be back in action again.  Here I describe two ways to handle this situation.

nopcommerce hosting

 

Method 1: Change the Existing Administrator Account Password

Log into your nopCommerce database using SQL Server Management Studio.  Click on the New Query  button and type this T-SQL code into the window:


SELECT Id FROM dbo.Customer
WHERE Username = ‘[email protected]


Replacing [email protected] with the administrator account email.  Hit F5 to execute the query.  This will return a number in the Results window needed for the next step.

Open another New Query window and enter this T-SQL statement in it:


UPDATE dbo.CustomerPassword
SET PasswordSalt = ”, PasswordFormatId = 0, Password = yournewpassword
WHERE CustomerId = Id


Replacing yournewpassword with your new password and Id with the number that was returned to you in the Results window.  This will allow you to log back in.  Make sure you go into the Administrator Dashboard within nopCommerce and change your password immediately (Login -> Customers -> Customers -> Edit -> Change Password).  Then go back into SQL Server Management Studio and issue this command:


DELETE FROM dbo.CustomerPassword
WHERE CustomerId = Id AND PasswordFormatId = 0


Replacing Id with the number from the Results window.  This step is important (deleting of the plain text password) as it will make it harder for the administrator account to be compromised, otherwise, the administrator account will now have 2 passwords with which you can login with.

 

 

Method 2: Create a Brand New User and Grant It Administrative Privileges

First, you’ll need to register a new account.  Go to your site’s registration page to create a new account.

Now, you’ll need to access your database using SQL Server Management Studio.    Login and then click on the New Query button.  Enter this T-SQL code in the window and hit F5 to execute it:


SELECT Id FROM dbo.Customer
WHERE Username = ‘[email protected]


Replacing [email protected] with the user account you just created.  This will return a number in the Results window needed for the next step (same steps as in Method 1). Open another New Query window and enter this T-SQL statement in the window:


INSERT INTO dbo.Customer_CustomerRole_Mapping (Customer_Id, CustomerRole_Id)
VALUES (Id, 1)


Replacing Id with the number from the Results window.  Now when you login using the new account, you’ll notice it has access to the Administration dashboard.  With this access, you can reset your other Administrative account password.  It’s up to you if you want to keep the new account you just created or delete it.

[Note: These instructions apply to nopCommerce 4.1.  They may be slightly different for past and future versions of nopCommerce if the database schema (structure) is different, but the idea is the same.]

 

Visit Everleap to learn more about our nopCommerce hosting solutions

 

Rate this article
   

No responses yet

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.



oui décor