How to Reset Forgot Password of nopCommerce Admin?

There might be a scenario where you have lost or forgotten the nopCommerce admin password. In such a situation, you can refer to the tutorial in this article, in which we will guide you on resetting your forgotten password of the nopCommerce admin. 

We have mentioned two options for regaining your access to nopCommerce admin; you must have MSSQL database user credentials to handle these steps. 

Important Note

This article will help you to reset the admin password of nopCommerce 4.1. If you have another version, there might be slight changes in steps.

Option 1

How to change the password of the existing administrator account?

1. Log into your SQL Server Management Studio with the nopCommerce DB user credentials. 

2. Click on the New Query and execute the query given inside the window.
Ensure that you replace the admin_user_email_address with your actual email address.

SELECT Id FROM dbo.Customer
WHERE Username = 'admin_user_email_address'

3. The above query will give you the user ID of the admin email address. You need to remember this ID to run the future query.

4. Again, click on the New Query and execute the T-SQL statement given below.
Ensure you replace your new password with the new password you want to reset and change the ID with the one received from the above query.

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


5. You have successfully changed the password of your nopCommerce admin.

Now go to Login >> Customers >> Customers >> Edit >> Change Password and instantly change your password that we have just reset. 

6. Return to the SQL Management Studio and execute the command given below – 

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

7. Replace the ID with the CustomerID we received in the first query. This command will delete the plain text password and prevent the account from being compromised.

 

Option 2

How to create a new user and grant Administrative Privileges to it?

1. Register a New User.

To do this, go to the customer registration page and create a new account

2. Access your database using SQL Management Studio. 

3. Click on the New Query and execute the T-SQL command shown below –

SELECT Id FROM dbo.Customer
WHERE Username = 'email_user'

4. Replace the email_user with the new email account you registered in step 1.

5. The above query will give you the ID of the newly registered user.
Run the query given below using the ID that we have received - 

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

6. Log in to your nopCommerce using the newly registered account, and you will find that it has administrative privileges. Using this account, you can change the password of your nopCommerce Admin, whose password you lost. 

7. Now, you can remove the newly created user or keep using it.



Was this answer helpful?

« Back

chat