Hi all.
I have a post controller with an action actionTest, which only allow authenticated user to access.
Therefore, guest user will be redirected to site/login automatically if he tried to access post/test.
(Am I right so far?)
My problem is that I’d like to redirect the user to fb login page, so my code in SiteController is:
public function actionLogin() {
if($this->_identity === null) {
$this->_identity = new UserIdentity($this->_facebook);
$this->_identity->authenticate();
}
if($this->_identity->errorCode === UserIdentity::ERROR_NONE) {
Yii::app()->user->login($this->_identity, 0);
$this->redirect(Yii::app()->homeUrl);
} else {
$this->redirect($this->_facebook->getLoginUrl());
}
However I can’t redirect it. I tried to modify it to be $this->redirect(“http://www.google.com”) and the result is the same.
The chrome error message show that "GET http://www.google.com undefine(undefined)"
How could I debug this? Please help, thanks!