Heuristic for stable9

Nextcloud 10 will have a way better logic...
This commit is contained in:
Lukas Reschke 2016-06-29 20:01:15 +02:00
parent 107be703bf
commit 487bf76165
No known key found for this signature in database
GPG Key ID: 9AB0ADB949B6898C
1 changed files with 3 additions and 1 deletions

View File

@ -50,8 +50,10 @@ try {
}
// Redirect all requests to the login page to the SAML login
// Since with Nextcloud 9 we don't have an unique entry point this is a little
// bit hacky and won't necessarily detect all situations.
$currentUrl = substr(explode('?',$request->getRequestUri(), 2)[0], strlen(\OC::$WEBROOT));
if($currentUrl === '/index.php/login' && !OC_User::isLoggedIn()) {
if(($currentUrl === '/' || $currentUrl === '/index.php/' || $currentUrl === '/index.php') && !OC_User::isLoggedIn()) {
$csrfToken = \OC::$server->getCsrfTokenManager()->getToken();
header('Location: '.$urlGenerator->linkToRouteAbsolute('user_saml.SAML.login') .'?requesttoken='. urlencode($csrfToken->getEncryptedValue()));
exit();