SleepWalker / hoauth

yii-hoauth provides simple integration with social network authorisation lib Hybridauth in Yii.
Other
59 stars 35 forks source link

return url after login and where I put the line of code #23

Closed debzar closed 11 years ago

debzar commented 11 years ago

I'm triyng to set the return url before logging into a provider. I read the Issue #20 but in HoAuthAction.php in which part of code I put the line?

SleepWalker commented 11 years ago

If you use the current version of github - it's support no returnUrl, while there is a popup authentication now (but I think, I will return the support of returnUrl later). If you use the version which is current on yii's website - you can use that line of code where you want, before the user will be authenticated. You can use setReturnUrl() for example on the sign-in page.

public function loginAction()
{
  Yii::app()->user()->returnUrl = Yii::app()->createUrl('user/profile');
...
$this->render('your login page view', array('param' => 'val'));
}
debzar commented 11 years ago

this works for me... in site ontroller public function hoauthAfterLogin(){

    Yii::app()->user->setReturnUrl('contact');
    $this->redirect(Yii::app()->user->returnUrl);

}    
SleepWalker commented 11 years ago

Oh yes. This is also a good approach!