Post by harap » Mon Oct 02, 2023 8:29 am

Hello,
Accidently disabled admin user. I can't login to admin site now. How can I find the file to re-create admin user login user ID and password?

Thanks in advance!
Last edited by harap on Tue Oct 03, 2023 11:44 pm, edited 1 time in total.

Active Member

Posts

Joined
Wed Sep 16, 2015 12:34 am
Location - United States

Post by SohBH » Mon Oct 02, 2023 2:40 pm

Enable admin user from database.

View all extensions | Request custom work | Pricing | Contact Me


User avatar
Active Member

Posts

Joined
Mon Nov 02, 2020 12:01 am
Location - Malaysia

Post by WaxedPerfection » Mon Oct 02, 2023 6:52 pm

LOGIN TO >> phpMyAdmin

Select your database XX_xXxXxXxX — Primary database for this environment

Select the oc_users table (If you have a custom database prefix this will be yourprefix_users.)

user_status — Set this to 1
Update : 1 to enable that user. 0 to disabled.

Click Go at the bottom
Click Go again on the query page
You should get a green check mark and success banner.
Last edited by WaxedPerfection on Tue Oct 03, 2023 3:29 pm, edited 1 time in total.

https://www.waxedperfection.co.uk/ Car Detailing Product Blog's and Review's


Active Member

Posts

Joined
Sun Mar 26, 2017 8:23 pm

Post by harap » Mon Oct 02, 2023 11:16 pm

@WaxedPerfection,
I can see oc_user, the status value already set to 0 already. But still can't login.
Can I set the value to 1 to enabled this user in order to be able to login from admin site?

Active Member

Posts

Joined
Wed Sep 16, 2015 12:34 am
Location - United States

Post by ADD Creative » Tue Oct 03, 2023 12:07 am

The status column should be set to 1 to enable that user. 0 will equate to disabled.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by harap » Tue Oct 03, 2023 2:51 am

No luck so far. I can see my setting in oc_user (Username, Password, Status 1). Admin site still not allow to login.

Active Member

Posts

Joined
Wed Sep 16, 2015 12:34 am
Location - United States

Post by harap » Tue Oct 03, 2023 9:18 am

Am I missing something? Hope someone can help. Thanks in advance!

Active Member

Posts

Joined
Wed Sep 16, 2015 12:34 am
Location - United States

Post by Cue4cheap » Tue Oct 03, 2023 9:44 am

harap wrote:
Tue Oct 03, 2023 9:18 am
Am I missing something? Hope someone can help. Thanks in advance!
Can you give details? Just how exactly did you disable the admin user?

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by harap » Tue Oct 03, 2023 12:11 pm

Can you give details? Just how exactly did you disable the admin user?
In admin site user setting, accidently clicked the disable button and saved the admin user. The nightmare begins, the admin site becomes inaccessible. Tried to recover it in oc_user from database, but the issue persists.

Active Member

Posts

Joined
Wed Sep 16, 2015 12:34 am
Location - United States

Post by WaxedPerfection » Tue Oct 03, 2023 3:27 pm

harap wrote:
Mon Oct 02, 2023 11:16 pm
@WaxedPerfection,
I can see oc_user, the status value already set to 0 already. But still can't login.
Can I set the value to 1 to enabled this user in order to be able to login from admin site?
Sorry that was a typo on my side it should have been one, as above. sorry again

https://www.waxedperfection.co.uk/ Car Detailing Product Blog's and Review's


Active Member

Posts

Joined
Sun Mar 26, 2017 8:23 pm

Post by ADD Creative » Tue Oct 03, 2023 4:11 pm

What message do you get when you try to login? Have you checked both your OpenCart and PHP error logs? What version of OpenCart are you using?

Could you password have been changed when you edited the user?

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by SohBH » Tue Oct 03, 2023 4:29 pm

Check your oc_user from cpanel backup.

View all extensions | Request custom work | Pricing | Contact Me


User avatar
Active Member

Posts

Joined
Mon Nov 02, 2020 12:01 am
Location - Malaysia

Post by harap » Tue Oct 03, 2023 10:44 pm

ADD Creative wrote:
Tue Oct 03, 2023 4:11 pm
What message do you get when you try to login? Have you checked both your OpenCart and PHP error logs? What version of OpenCart are you using?

Could you password have been changed when you edited the user?
I'm using OC v4.0.2.3 and running PHP8.1. Unable to login Admin site always show "No match for Username and/or Password.".
I can see error log /storage folder from cPanel:
----------------------------------------------------------------------------
2023-10-01 00:01:33 - Call to undefined function Opencart\System\Helper\Utf8\strlen() in /home/SorryHided/SorryHidedmysite/catalog/controller/product/askquestion.php on line 65
2023-10-01 07:38:06 - 0: Error: Table 'test.oc_user_history' doesn't exist<br/>Error No: 1146<br/>DELETE FROM `oc_user_history` WHERE `user_id` = '1'
File: /home/SorryHided/SorryHidedmysite/system/library/db/mysqli.php
Line: 76

2023-10-01 07:38:22 - 0: Error: Table 'test.oc_user_history' doesn't exist<br/>Error No: 1146<br/>DELETE FROM `oc_user_history` WHERE `user_id` = '1'
File: /home/SorryHided/SorryHidedmysite/system/library/db/mysqli.php
Line: 76
--------------------------------------------------------------------------------
The site no cPanel backup yet because this is a new staging test site.

Active Member

Posts

Joined
Wed Sep 16, 2015 12:34 am
Location - United States

Post by ADD Creative » Tue Oct 03, 2023 11:24 pm

Those errors would occur if you had deleted a user. Check you user entry in the database is still there.

Have you tried resetting your password?

You can do this in the database. Make a backup of your database first. Goto the oc_user table in phpMyAdmin and edit the row you want to change. On the password row select MD5 as the function from the drop down. Change the value to a new password. Login to admin using the new password.

Once logged in change the password again for that user in the admin. This will ensure it will be hashed correctly.

Or you could just run a SQL query for a selected user_id.

Code: Select all

UPDATE `oc_user` SET `password` = md5('password123') WHERE `user_id` = 1

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by harap » Tue Oct 03, 2023 11:44 pm

ADD Creative wrote:
Tue Oct 03, 2023 11:24 pm
Those errors would occur if you had deleted a user. Check you user entry in the database is still there.

Have you tried resetting your password?

You can do this in the database. Make a backup of your database first. Goto the oc_user table in phpMyAdmin and edit the row you want to change. On the password row select MD5 as the function from the drop down. Change the value to a new password. Login to admin using the new password.

Once logged in change the password again for that user in the admin. This will ensure it will be hashed correctly.
Yes, Thank you very much for the help. Select MD5 function for the password solved the problem. Owe you a Starbucks.
Thank you all.

Cheer!

Active Member

Posts

Joined
Wed Sep 16, 2015 12:34 am
Location - United States
Who is online

Users browsing this forum: No registered users and 3 guests