orangehrm / orangehrm

OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures all the essential functionalities required for any enterprise.
GNU General Public License v3.0
746 stars 537 forks source link

Unable to Login as Admin OrangeHRM #664

Closed tjudayasankar closed 3 years ago

tjudayasankar commented 3 years ago

Hello,

I have downloaded OrangeHRM 4.4 from Source Forge. Accidentally I have changed the Admin user role to Ess. I had created only one Admin account. How can I create a new admin account. Is there any way to create a new admin user.

RajithaKumara commented 3 years ago

Hi You can restore Admin user by running below query in your OrangeHRM database. Assuming your admin user name Admin

UPDATE `ohrm_user` SET `user_role_id`=1 WHERE `user_name`="Admin";
tjudayasankar commented 3 years ago

Thank you @RajithaKumara but I am unable to find ohrm_user or hs_hr_user.

RajithaKumara commented 3 years ago

Did you select the OrangeHRM database before run update query.

tjudayasankar commented 3 years ago

Thank you @RajithaKumara . But this is the error that I receive when I try to execute the code.

`SELECT ohrm_user; UPDATE 'ohrm_user' SET 'user_role_id'=1 WHERE 'user_name'="Admin";

Error SQL query: Copy Documentation

SELECT ohrm_user MySQL said: Documentation

1054 - Unknown column 'ohrm_user' in 'field list'`

RajithaKumara commented 3 years ago

Oo. Actually I don't know your OrangeHRM database. But you can find it by running below queries in your database server.

SHOW DATABASES;

Guess OrangeHRM database from the database list and run below command to select database :smiley: . Let say database name orangehrm_mysql

USE `orangehrm_mysql`;

Now you can check whatever the selected database is OrangeHRM one.

SHOW TABLES;
#or
SHOW TABLES LIKE 'ohrm_user';

If you got result for above query, you are ready to run update query.

UPDATE `ohrm_user` SET `user_role_id`=1 WHERE `user_name`="Admin";
tjudayasankar commented 3 years ago

Thank you @RajithaKumara . Since I am using phpmyadmin I thought all my tables and databases are open to my naked eye. I was lazy enough that I did not download mysql. I will download it and work on it and will get back to you.

Or is there a way to solve it using phpmyadmin? Please ignore my ignorance I am new to phpmyadmin, mysql and orangehrm but I am working on it.

Thank you, Tharun

RajithaKumara commented 3 years ago

orangehrm_664

  1. Select database (click on +)
  2. Search ohrm_user table
  3. Click on ohrm_user
  4. Double click on user_role_id column, Admin row and update value as 1
SviatoslavBordovski commented 3 years ago

Can someone just set the correct credentials on the frontend? I am making the the opensource project to demonstrate on the bootcamp and tests are failing now because of this issue.

SviatoslavBordovski commented 3 years ago

FYI, valid username is admin now

RajithaKumara commented 3 years ago

Can someone just set the correct credentials on the frontend?

You can use Fogot password option at the login screen. But that feature required valid email configuration to send reset password email.

tjudayasankar commented 3 years ago

Perfect @RajithaKumara it worked. Thank you.