0

I need to integrate a users table instead of the default Joomla _user table.

The table pref_users has simple id/user/email/password fields (not hashed). Is there anyway I can make Joomla use it instead of the default table for users?

  • 1
    Doing that will involve a large amount of core changes, not to mention you will get a load of errors due to a format mismatch. Also, why would you password values not be hashed? I don't see why you can't simply put all the data from you table into the default #__users table and then run a simple PHP script to hash each password. Joomla is CMS, therefore you're supposed to use what's built into it. Don't start changing the way it works. If you need anything extra, then built on top of what is already provided – Lodder Apr 4 '15 at 9:09
  • Alright that makes sense. How would I run a script to hash all my passwords? I was Googling it and it says Joomla uses md5 salt and hash but from there i'm not sure what to do next. – Sosa Apr 4 '15 at 9:22
  • Well you're using Joomla 3.x which uses bcrypt. Run a database query to get all the passwords, then in a foreach loop, use the bcrypt function. – Lodder Apr 4 '15 at 9:25
1

You can check user helper file in Joomla! library {site_root}/libraries/user/helper.php

You will find all related functions over there. To convert pain text to hash password there is a function called getCryptedPassword. This function accepts several arguments. In most cases default arguments works perfectly, but You can use them as per your need.

With default argument:

$passwordhash = JUserHelper::getCryptedPassword('plain_text_password'); 
  • 1
    getCryptedPassword by default uses md5_hex, so seeing as this is Joomla 3.x, should the OP not be used JUserHelper::hashPassword('plan_text') ? – Lodder Apr 4 '15 at 12:17
  • But as he is going to create his own user table and user functionality (as changing table will surely need to change whole user logic to...). He can use it. – SD. Apr 4 '15 at 12:21
  • If it is only matter of converting plain text to what Joomla is using. Then you are correct, we have to pass crypt-blowfish in argument. – SD. Apr 4 '15 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.