Skip to content
Permalink
Browse files

Extract method for easier extension/overwriting.

  • Loading branch information...
dereuromark committed Oct 13, 2016
1 parent f71b823 commit 0b9fcb35628cf36a7b6bcb4194b64019832702ad
Showing with 19 additions and 4 deletions.
  1. +19 −4 src/Controller/Component/AuthComponent.php
@@ -402,10 +402,7 @@ protected function _unauthenticated(Controller $controller)
*/
protected function _loginActionRedirectUrl()
{
$urlToRedirectBackTo = $this->request->here(false);
if (!$this->request->is('get')) {
$urlToRedirectBackTo = $this->request->referer(true);
}
$urlToRedirectBackTo = $this->_getUrlToRedirectBackTo();
$loginAction = $this->_config['loginAction'];
if ($urlToRedirectBackTo === '/') {
@@ -999,4 +996,22 @@ public function authorizationProvider()
{
return $this->_authorizationProvider;
}
/**
* Returns the URL to redirect back to or / if not possible.
*
* This method takes the referrer into account as long as the
* request is of type GET.
*
* @return string
*/
protected function _getUrlToRedirectBackTo()
{
$urlToRedirectBackTo = $this->request->here(false);
if (!$this->request->is('get')) {
$urlToRedirectBackTo = $this->request->referer(true);
}
return $urlToRedirectBackTo;
}
}

0 comments on commit 0b9fcb3

Please sign in to comment.
You can’t perform that action at this time.