0

I am developing a script that is using Joomla!'s users table for the user authentication ... but I am facing an issue with the verification of the password.

As you know Joomla! uses Bcrypt for encrypting the passwords so I have added the Bcrypt encryption to my script as well but it generates a new hash for the same password ...

I am stuck on how can I verify the password hash stored in the users table with the hash generated through my external script.

Joomla 3.7.2

Thanks for your answers in advance.

  • Some conditions are involving. As a clue, check the method verifyPassword in the file [JOOMLA_ROOT]/libraries/joomla/user/helper.php. – Farahmand Jul 2 '17 at 7:58
0

I got this working for me ... On the internet there are many solution for this but they don't explain this in details on how we can achieve this correctly ... So I am posting my answer for those who are new to this like me.

In my question I explained that I am creating a external script that will be using joomla site's database which I have already up and running ... Please note that the external script that I am writing and the joomla site, both are hosted on the same server but are in separate directories. Below is the code that I have used ... this code is available on most of the joomla forums and even on stack overflow but I have slightly modified it according my needs but it will work on any script.

define('_JEXEC', 1);
define('JPATH_BASE', '/Users/faisalhussain/Sites/joomla/');
require_once JPATH_BASE . 'includes/defines.php';
require_once JPATH_BASE . 'includes/framework.php';

Most answers I came accross don't explain that in order for the above code to work you need to have a working joomla installation ... As I mentioned before that my script and my joomla site are on the same server but in separate directories so I had to provide a absolute path to my joomla installation define('JPATH_BASE', '/Users/faisalhussain/Sites/joomla/'); ... but if you are creating a script that is within the root of joomla then you can use relative path. After implementing the above code now I can use any method of any joomla class within my external script. Hope this helps anyone who is in need to use joomla framework outside of joomla.

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.