diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-05-15 09:49:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-15 09:49:11 -0500 |
commit | 8c5062794f3abc157e48af2cf4bc3c0dfe570cbe (patch) | |
tree | 7f7725c48d472766b0d6a2933b1939d5c5ce4258 /core | |
parent | 3bd51321de17b7a4dea361955c4affc1aff92739 (diff) | |
parent | 72c1b248442fb05ef2ef1e8fbf3399cb06188013 (diff) | |
download | nextcloud-server-8c5062794f3abc157e48af2cf4bc3c0dfe570cbe.tar.gz nextcloud-server-8c5062794f3abc157e48af2cf4bc3c0dfe570cbe.zip |
Merge pull request #4873 from nextcloud/check-whether-REQUEST-exists
Check whether the $_SERVER['REQUEST_*'] vars exist before using them
Diffstat (limited to 'core')
-rw-r--r-- | core/Middleware/TwoFactorMiddleware.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/Middleware/TwoFactorMiddleware.php b/core/Middleware/TwoFactorMiddleware.php index c4c3b724eb5..e35c53d4049 100644 --- a/core/Middleware/TwoFactorMiddleware.php +++ b/core/Middleware/TwoFactorMiddleware.php @@ -124,9 +124,11 @@ class TwoFactorMiddleware extends Middleware { public function afterException($controller, $methodName, Exception $exception) { if ($exception instanceof TwoFactorAuthRequiredException) { - return new RedirectResponse($this->urlGenerator->linkToRoute('core.TwoFactorChallenge.selectChallenge', [ - 'redirect_url' => urlencode($this->request->server['REQUEST_URI']), - ])); + $params = []; + if (isset($this->request->server['REQUEST_URI'])) { + $params['redirect_url'] = $this->request->server['REQUEST_URI']; + } + return new RedirectResponse($this->urlGenerator->linkToRoute('core.TwoFactorChallenge.selectChallenge', $params)); } if ($exception instanceof UserAlreadyLoggedInException) { return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index')); |