Redirect to original URL after oauth login
This commit is contained in:
@@ -64,20 +64,4 @@ class AuthController extends BaseController
|
|||||||
$this->response->redirect($this->helper->url->to('DashboardController', 'show'));
|
$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;
|
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)
|
protected function authenticate($providerName)
|
||||||
{
|
{
|
||||||
if ($this->authenticationManager->oauthAuthentication($providerName)) {
|
if ($this->authenticationManager->oauthAuthentication($providerName)) {
|
||||||
$this->response->redirect($this->helper->url->to('DashboardController', 'show'));
|
$this->redirectAfterLogin();
|
||||||
} else {
|
} else {
|
||||||
$this->authenticationFailure(t('External authentication failed'));
|
$this->authenticationFailure(t('External authentication failed'));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user