Probably somebody knows where to get or how to create a bridge to integrate vVulletin into Yii based web site?
- to be able to use login/password for Yii and vBulletin authorization.
Thanks.
Probably somebody knows where to get or how to create a bridge to integrate vVulletin into Yii based web site?
Thanks.
Make a UserIdentity class which inherits from CUserIdentity:
<?php
/**
* UserIdentity represents the data needed to identity a user.
* It contains the authentication method that checks if the provided
* data can identity the user.
*/
class UserIdentity extends CUserIdentity
{
const ERROR_CONFIRMREGISTRATION=4;
private $_id;
/**
* Authenticates a user.
* @return boolean whether authentication succeeds.
*/
public function authenticate($md5=true)
{
$user=User::model()->find('LOWER(username)=?',array(strtolower($this->username)));
if($user===null)
$this->errorCode=self::ERROR_USERNAME_INVALID;
else if((($md5)?md5($this->password):$this->password)!==$user->password)
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else if($user->confirmRegistration)
$this->errorCode=self::ERROR_CONFIRMREGISTRATION;
else
{
$this->_id=$user->id;
$this->username=$user->username;
$this->errorCode=self::ERROR_NONE;
}
return !$this->errorCode;
}
/**
* @return integer the ID of the user record
*/
public function getId()
{
return $this->_id;
}
}
Do your stuff in authenticate().