summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/bootstrap/auth.php5
-rw-r--r--controllers/UsersController.php9
2 files changed, 11 insertions, 3 deletions
diff --git a/config/bootstrap/auth.php b/config/bootstrap/auth.php
index acbc4d5..a82d63a 100644
--- a/config/bootstrap/auth.php
+++ b/config/bootstrap/auth.php
@@ -123,7 +123,10 @@ Dispatcher::applyFilter('_callable', function($self, $params, $chain) {
return $ctrl;
}
- //Otherwise, send them to the login page
+ //Save the location they are going to
+ $value = array('controller' => $ctrl->request->controller, 'action' => $ctrl->request->action, 'args' => $ctrl->request->args);
+ Session::write('url', $value);
+ //Redirect them to the login page
return function() use ($request) {
return new Response(compact('request') + array('location' => '/login'));
};
diff --git a/controllers/UsersController.php b/controllers/UsersController.php
index cc0b3db..fdea5f8 100644
--- a/controllers/UsersController.php
+++ b/controllers/UsersController.php
@@ -319,9 +319,14 @@ class UsersController extends \lithium\action\Controller {
}
//If the user was trying to go somewhere, redirect them there
- if ($location != null)
+ $loc = Session::read('url');
+ if (isset($loc))
{
-
+ Session::delete('url');
+ return $this->redirect(array('controller' => $loc['controller'],
+ 'action' => $loc['action'],
+ 'args' => $loc['args']
+ ));
}
//Otherwise send them to the hompa
return $this->redirect('Users::feed');