diff options
author | Joas Schilling <coding@schilljs.com> | 2017-05-15 14:33:27 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-05-15 14:33:27 +0200 |
commit | 72c1b248442fb05ef2ef1e8fbf3399cb06188013 (patch) | |
tree | 49887a496537c7c3a673d4f7319b04721fae517a /core/Middleware | |
parent | c56c98183d2c8078c436e9b2e0c4f2a0031b4729 (diff) | |
download | nextcloud-server-72c1b248442fb05ef2ef1e8fbf3399cb06188013.tar.gz nextcloud-server-72c1b248442fb05ef2ef1e8fbf3399cb06188013.zip |
Check whether the $_SERVER['REQUEST_*'] vars exist before using them
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Middleware')
-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')); |