diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-08-18 14:58:03 +0300 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-08-18 14:58:03 +0300 |
commit | 940bcd30a31771461e6fd14318f3cbb8f79ff362 (patch) | |
tree | c093a008a8497b5babf7ab4bafce6ff9787dbe63 /appinfo/app.php | |
parent | 6466e71c637fa3093325a1320e81750109e08207 (diff) |
Redirect users to previous page
This change ensures that users will be sent to the previous page.
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'appinfo/app.php')
-rw-r--r-- | appinfo/app.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/appinfo/app.php b/appinfo/app.php index d0246488..23dbe6c0 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -28,7 +28,6 @@ if(OC::$CLI) { $cli = true; } - $urlGenerator = \OC::$server->getURLGenerator(); $config = \OC::$server->getConfig(); $request = \OC::$server->getRequest(); @@ -99,7 +98,20 @@ if($useSamlForDesktopClients === '1') { } if($redirectSituation === true) { + $params = $request->getParams(); + $originalUrl = ''; + if(isset($params['redirect_url'])) { + $originalUrl = $urlGenerator->getAbsoluteURL($params['redirect_url']); + } + $csrfToken = \OC::$server->getCsrfTokenManager()->getToken(); - header('Location: '.$urlGenerator->linkToRouteAbsolute('user_saml.SAML.login') .'?requesttoken='. urlencode($csrfToken->getEncryptedValue())); + $targetUrl = $urlGenerator->linkToRouteAbsolute( + 'user_saml.SAML.login', + [ + 'requesttoken' => $csrfToken->getEncryptedValue(), + 'originalUrl' => $originalUrl, + ] + ); + header('Location: '.$targetUrl); exit(); } |