Hi everyone,
I have a application with is using sessions and cookies are disabled : ‘allowAutoLogin’ => false;
I’m trying to create a functionality as follows:
When a user logs in I store the session id of the user in the database.
(Yii::app()->session->sessionID)
Now when a user tries to login from a different browser or IP address the previous user session should be deleted before new session created during login.
public function beforeLogin($id, $states, $fromCookie)
{
$oldslog = UserSessionLog::model()->findByAttributes(array('account_id'=> $states['account_id'] ), array('order' =>'session_log_id DESC'));
Yii::app()->session->setSessionID($oldslog->session_log_sessid);
Yii::app()->session->destroy();
return true;
}
But there is no success. Is this method the right way or there is a better way to do the same.