diff options
author | Lim Yuen Hoe <yuenhoe@hotmail.com> | 2014-09-19 01:38:38 +0800 |
---|---|---|
committer | Lim Yuen Hoe <yuenhoe@hotmail.com> | 2014-09-19 01:48:45 +0800 |
commit | ed13a04c4c7906c190c4a02acecb27a77b3bdb2a (patch) | |
tree | aa7eef726548ed7223449a02a149af3b7b7a8c4f /app/Controller/User.php | |
parent | 7fac9783c6593f89266e6d152faeb2aef09b6dfc (diff) |
redirect to original target page after logging in
Diffstat (limited to 'app/Controller/User.php')
-rw-r--r-- | app/Controller/User.php | 10 |
1 files changed, 9 insertions, 1 deletions
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') ))); } |