summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorkent1 <kent1@arscenic.info>2018-03-05 19:43:15 +0100
committerFrédéric Guillot <fred@kanboard.net>2018-03-05 10:43:15 -0800
commita991758e98fc614d35ec67ec904c78fa0ff6feeb (patch)
tree213a76e65fb8c66fdf4748026cc1f70e8d1253b8 /app
parentb4beace91c552a810cdac61e85f4a1b2904f0df2 (diff)
Redirect to original URL after oauth login
Diffstat (limited to 'app')
-rw-r--r--app/Controller/AuthController.php16
-rw-r--r--app/Controller/BaseController.php16
-rw-r--r--app/Controller/OAuthController.php2
3 files changed, 17 insertions, 17 deletions
diff --git a/app/Controller/AuthController.php b/app/Controller/AuthController.php
index 06bcd913..474783eb 100644
--- a/app/Controller/AuthController.php
+++ b/app/Controller/AuthController.php
@@ -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'));
- }
- }
}
diff --git a/app/Controller/BaseController.php b/app/Controller/BaseController.php
index 1433ec14..c984a702 100644
--- a/app/Controller/BaseController.php
+++ b/app/Controller/BaseController.php
@@ -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'));
+ }
+ }
}
diff --git a/app/Controller/OAuthController.php b/app/Controller/OAuthController.php
index 7663ddcc..abd9b2e7 100644
--- a/app/Controller/OAuthController.php
+++ b/app/Controller/OAuthController.php
@@ -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'));
}