I have a solution for Joomla 1.5 and CB 1.2.
First you create a new function in "administrator/components/com_comprofiler/library/cb/cb.tables"
Just after the loadByUsername() one.
[code:1]/**
* Loads user email from database
*
* @param string $username
* @return boolean TRUE: success, FALSE: error in database access
*/
function loadByEmail( $email ) {
if ( $email == null ) {
return false;
}
//BB fix : resets default values to all object variables, because NULL SQL fields do not overide existing variables !
//Note: Prior to PHP 4.2.0, Uninitialized class variables will not be reported by get_class_vars().
$class_vars = get_class_vars(get_class($this));
foreach ($class_vars as $name => $value) {
if ( ($name != $this->_tbl_key) and ($name != "_db"«») and ($name != "_tbl"«») and ($name != "_tbl_key"«») ) {
$this->$name = $value;
}
}
$this->reset();
//end of BB fix.
$query = 'SELECT *'
. "\n FROM " . $this->_cmsUserTable . ' AS u'
. "\n LEFT JOIN " . $this->_tbl . ' AS c ON c.' . $this->_tbl_key . ' = u.' . $this->_cmsUserTableKey
. " WHERE u." . $this->_cmsUserTableEmail . ' = ' . $this->_db->Quote( $email )
;
$this->_db->setQuery( $query );
$arr = $this->_db->loadAssoc( );
if ( $arr ) {
foreach ( $arr as $k => $v ) {
$this->$k = $v;
}
return true;
} else {
return false;
}
}[/code:1]
After you find (Aroud line 1480) :
[code:1] if ( $row->loadByUsername( stripslashes( $username ) ) && cbHashPassword( $passwd2, $row ) ) {[/code:1]
You replace it by :
[code:1]if ( $row->loadByEmail( stripslashes( $username ) ) && cbHashPassword( $passwd2, $row ) ) {[/code:1]
After you find (Aroud line 1542) :
[code:1]$_CB_framework->login( $username, $passwd2, $rememberMe );[/code:1]
You replace it by :
[code:1]$_CB_framework->login( $row->username, $passwd2, $rememberMe );[/code:1]
After that you can login only with email. It's working for me but I'am not sure it's well secure.
Is it working for you ?
Post edited by: beubeu2k, at: 2008/06/13 14:34
Post edited by: beubeu2k, at: 2008/06/13 14:35