Redirect to original URL after oauth login
This commit is contained in:
parent
b4beace91c
commit
a991758e98
|
|
@ -64,20 +64,4 @@ class AuthController extends BaseController
|
|||
$this->response->redirect($this->helper->url->to('DashboardController', 'show'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect the user after the authentication
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function redirectAfterLogin()
|
||||
{
|
||||
if (session_exists('redirectAfterLogin') && ! filter_var(session_get('redirectAfterLogin'), FILTER_VALIDATE_URL)) {
|
||||
$redirect = session_get('redirectAfterLogin');
|
||||
session_remove('redirectAfterLogin');
|
||||
$this->response->redirect($redirect);
|
||||
} else {
|
||||
$this->response->redirect($this->helper->url->to('DashboardController', 'show'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,4 +305,20 @@ abstract class BaseController extends Base
|
|||
|
||||
return $filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect the user after the authentication
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function redirectAfterLogin()
|
||||
{
|
||||
if (session_exists('redirectAfterLogin') && ! filter_var(session_get('redirectAfterLogin'), FILTER_VALIDATE_URL)) {
|
||||
$redirect = session_get('redirectAfterLogin');
|
||||
session_remove('redirectAfterLogin');
|
||||
$this->response->redirect($redirect);
|
||||
} else {
|
||||
$this->response->redirect($this->helper->url->to('DashboardController', 'show'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class OAuthController extends BaseController
|
|||
protected function authenticate($providerName)
|
||||
{
|
||||
if ($this->authenticationManager->oauthAuthentication($providerName)) {
|
||||
$this->response->redirect($this->helper->url->to('DashboardController', 'show'));
|
||||
$this->redirectAfterLogin();
|
||||
} else {
|
||||
$this->authenticationFailure(t('External authentication failed'));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue