diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-09-19 20:45:40 +0200 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-09-19 20:45:40 +0200 |
commit | 9ffa63747ae5a5ecfe8ac3e6a3276ade80e6980b (patch) | |
tree | 5c900006fc24daac1d212a0de17f6d6b70c1a9cd /app/Controller | |
parent | 082fda68ca52e8ace083256c57fd0da9991cde7b (diff) | |
parent | ed13a04c4c7906c190c4a02acecb27a77b3bdb2a (diff) |
Merge pull-request #274 (url redirection/session expired)
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Base.php | 2 | ||||
-rw-r--r-- | app/Controller/User.php | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/app/Controller/Base.php b/app/Controller/Base.php index 1ef54d8e..93749ea6 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -124,7 +124,7 @@ abstract class Base // Authentication if (! $this->authentication->isAuthenticated($controller, $action)) { - $this->response->redirect('?controller=user&action=login'); + $this->response->redirect('?controller=user&action=login&redirect_query='.urlencode($this->request->getQueryString())); } // Check if the user is allowed to see this page diff --git a/app/Controller/User.php b/app/Controller/User.php index a02dd7be..72ef521c 100644 --- a/app/Controller/User.php +++ b/app/Controller/User.php @@ -34,10 +34,12 @@ class User extends Base $this->response->redirect('?controller=app'); } + $redirect_query = $this->request->getStringParam('redirect_query'); $this->response->html($this->template->layout('user_login', array( 'errors' => array(), 'values' => array(), 'no_layout' => true, + 'redirect_query' => $redirect_query, 'title' => t('Login') ))); } @@ -49,17 +51,23 @@ class User extends Base */ public function check() { + $redirect_query = $this->request->getStringParam('redirect_query'); $values = $this->request->getValues(); list($valid, $errors) = $this->authentication->validateForm($values); if ($valid) { - $this->response->redirect('?controller=board'); + if ($redirect_query != "") { + $this->response->redirect('?'.$redirect_query); + } else { + $this->response->redirect('?controller=board'); + } } $this->response->html($this->template->layout('user_login', array( 'errors' => $errors, 'values' => $values, 'no_layout' => true, + 'redirect_query' => $redirect_query, 'title' => t('Login') ))); } |