Created
August 10, 2012 07:08
-
-
Save biswarupadhikari/3312105 to your computer and use it in GitHub Desktop.
How to validate Joomla Login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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