So, i’ve been trying to figure this out. This is the results i’ve got so far.
Now in the developmentphase both OC and Yii are on the same domain and server. (localhost)
After the launch, the sites will remain on the same server, but on different domains. Not subdomains.
When im working on the same domain, the two uses the same PHPSESSID, but they store information very diffrently.
This is my session-content after logging in on both applications, using the same user from the same db-table:
cd7e1979f40f0644e3fe05f5809fd61a__id|s:20:"my@email.com";
cd7e1979f40f0644e3fe05f5809fd61a__name|s:20:"my@email.com";
cd7e1979f40f0644e3fe05f5809fd61acustomer_id|s:1:"1";
cd7e1979f40f0644e3fe05f5809fd61a__states|a:1:{s:11:"customer_id";b:1;}
cd7e1979f40f0644e3fe05f5809fd61aYii.CWebUser.flashcounters|a:0:{}
language|s:2:"en";
currency|s:3:"USD";
cart|a:0:{}customer_id|s:1:"1";
shipping_country_id|s:3:"160";
shipping_zone_id|s:4:"2447";
shipping_postcode|s:4:"3014";
If anyone else is experimenting with the same, you have to rewrite your UserIdentity to something slimilar to this, where the pass is salted and SHA1-encryped several times:
public function authenticate()
{
$user = Customer::model()->findByAttributes(array('email'=>$this->username));
if ($user===null) { // No user found!
$this->errorCode=self::ERROR_USERNAME_INVALID;
} else if ($user->password !== SHA1($user->salt.SHA1($user->salt.SHA1($this->password)))) { // Invalid password!
$this->errorCode=self::ERROR_PASSWORD_INVALID;
} else { // Okay!
$this->errorCode=self::ERROR_NONE;
$this->setState('id', $user->id);
}
}
}
So the session does not work on both pages (well, the logout does, Score!) because yii stores the customer_id in "cd7e1979f40f0644e3fe05f5809fd61a__states" variable in the session.
And the only reason the apps are using the same session now, is the fact that they are on the same domain, so i have to find a workAround for that aswell.
Thats all i have so far. Im gonna keep posting here, both to get good tips from other users, and maybe someone else gets some use of it.