Use joomla.user.authentication to authenticate only Administ - Joomla! Forum - community, help and support
i'm using function
its authenticate user, restring return true if user "super administrator"
the $response object jauthenticationresponse , has return this
<pre>jauthenticationresponse object
(
[status] => 1
[type] => joomla
[error_message] =>
[username] => admin
[password] => 123
[email] => user@gmail.com
[fullname] => administrator
[birthdate] =>
[gender] =>
[postcode] =>
[country] =>
[language] =>
[timezone] =>
[_errors] => array
(
)
)
</pre>
but no group of user.
thx help!
code: select all
/**
* authenticateuser
*
* @abstract authentic user in jos_users
*
* @param string $username
* @param string $password
*
* @return bool
*/
function authenticateuser($username, $password)
{
// global jauthentication object
jimport( 'joomla.user.authentication');
$auth = & jauthentication::getinstance();
$credentials = array( 'username' => $username, 'password' => $password );
$options = array();
$response = $auth->authenticate($credentials, $options);
return $response->status === jauthenticate_status_success;
}
its authenticate user, restring return true if user "super administrator"
the $response object jauthenticationresponse , has return this
<pre>jauthenticationresponse object
(
[status] => 1
[type] => joomla
[error_message] =>
[username] => admin
[password] => 123
[email] => user@gmail.com
[fullname] => administrator
[birthdate] =>
[gender] =>
[postcode] =>
[country] =>
[language] =>
[timezone] =>
[_errors] => array
(
)
)
</pre>
but no group of user.
thx help!
battisti wrote:i'm using functioncode: select all
/**
* authenticateuser
*
* @abstract authentic user in jos_users
*
* @param string $username
* @param string $password
*
* @return bool
*/
function authenticateuser($username, $password)
{
// global jauthentication object
jimport( 'joomla.user.authentication');
$auth = & jauthentication::getinstance();
$credentials = array( 'username' => $username, 'password' => $password );
$options = array();
$response = $auth->authenticate($credentials, $options);
return $response->status === jauthenticate_status_success;
}
its authenticate user, restring return true if user "super administrator"
the $response object jauthenticationresponse , has return this
<pre>jauthenticationresponse object
(
[status] => 1
[type] => joomla
[error_message] =>
[username] => admin
[password] => 123
[email] => user@gmail.com
[fullname] => administrator
[birthdate] =>
[gender] =>
[postcode] =>
[country] =>
[language] =>
[timezone] =>
[_errors] => array
(
)
)
</pre>
but no group of user.
thx help!
if user's authenticated, grab group database
code: select all
/**
* authenticateuser
*
* @abstract authentic user in jos_users
*
* @param string $username
* @param string $password
*
* @return bool
*/
function authenticateuser($username, $password)
{
// global jauthentication object
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 )
{
$database =& jfactory::getdbo();
$database->setquery( 'select gid #__users username = '.$database->quote( $username ).' , gid = 25' );
return (bool)($database->query());
}
return false;
}
untested... idea
Comments
Post a Comment