Skip to content

Instantly share code, notes, and snippets.

@biswarupadhikari
Created August 10, 2012 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biswarupadhikari/3312105 to your computer and use it in GitHub Desktop.
Save biswarupadhikari/3312105 to your computer and use it in GitHub Desktop.
How to validate Joomla Login
<?php
function validateLogin($username,$password){
jimport( 'joomla.user.authentication');
$auth = & JAuthentication::getInstance();
$credentials = array( 'username' => $username, 'password' => $password );
$options = array();
$response = $auth->authenticate($credentials, $options);
if ($response->status === JAUTHENTICATE_STATUS_SUCCESS) {
$response->status = true;
$user=JFactory::getUser($username);
return $user;
} else {
return false;
}
}
$username=JRequest::getVar('username');
$password=JRequest::getVar('password');
if(validateLogin($username,$password)){
echo "User Login Sucessfully";
}
else{
echo "entered Wrong Username and Password";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment