summaryrefslogtreecommitdiffstats
path: root/application/controllers/user.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-08-18 22:01:18 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-08-18 22:01:18 +0200
commit1c247bc4073451ad156ecedfbd2f7ebe73b56c12 (patch)
tree522b1527126d4b687229fb3e2c50a3c052f4f310 /application/controllers/user.php
parentf0dd547bd84b4461cdab8d7d556bdb275bf4864a (diff)
Fix redirect URI when using multiple tabs
If we store only the last called URI in the session we can't support multiple browser tabs that all need to log in again. Fix this by storing the URI in the URL. Also change a trim() to ltrim() so that the URI string we store keeps it's trailing slash. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers/user.php')
-rw-r--r--application/controllers/user.php19
1 files changed, 12 insertions, 7 deletions
diff --git a/application/controllers/user.php b/application/controllers/user.php
index b432cba5e..eca0b7da3 100644
--- a/application/controllers/user.php
+++ b/application/controllers/user.php
@@ -44,8 +44,18 @@ class User extends MY_Controller {
function login()
{
+ $redirect_uri = $this->input->get("redirect_uri");
$this->muser->require_session();
- $this->session->keep_flashdata("uri");
+
+ if (!preg_match('/^[0-9a-zA-Z\/_]*$/', $redirect_uri)) {
+ $redirect_uri = '/';
+ }
+
+ if ($this->muser->logged_in()) {
+ redirect($redirect_uri);
+ }
+
+ $this->data['redirect_uri'] = $redirect_uri;
if ($this->input->post('process') !== false) {
$username = $this->input->post('username');
@@ -59,12 +69,7 @@ class User extends MY_Controller {
$this->load->view($this->var->view_dir.'login', $this->data);
$this->load->view('footer', $this->data);
} else {
- $uri = $this->session->flashdata("uri");
- if ($uri) {
- redirect($uri);
- } else {
- redirect("/");
- }
+ redirect($redirect_uri);
}
} else {
$this->load->view('header', $this->data);