Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

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

Closed
debzar opened this issue Oct 16, 2013 · 3 comments
Closed

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

debzar opened this issue Oct 16, 2013 · 3 comments
Labels

Comments

@debzar
Copy link

debzar commented Oct 16, 2013

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
Copy link
Owner

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 debzar closed this as completed Oct 16, 2013
@debzar debzar reopened this Oct 16, 2013
@debzar
Copy link
Author

debzar commented Oct 16, 2013

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

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

}    

@debzar debzar closed this as completed Oct 16, 2013
@SleepWalker
Copy link
Owner

Oh yes. This is also a good approach!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants