diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/NavigationManager.php | 24 | ||||
-rw-r--r-- | lib/private/legacy/user.php | 15 |
2 files changed, 19 insertions, 20 deletions
diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index b854b44b340..5e484bea737 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -187,18 +187,18 @@ class NavigationManager implements INavigationManager { 'icon' => $this->urlGenerator->imagePath('settings', 'admin.svg'), ]); - // Logout - $this->add([ - 'type' => 'settings', - 'id' => 'logout', - 'order' => 99999, - 'href' => $this->urlGenerator->linkToRouteAbsolute( - 'core.login.logout', - ['requesttoken' => \OCP\Util::callRegister()] - ), - 'name' => $l->t('Log out'), - 'icon' => $this->urlGenerator->imagePath('core', 'actions/logout.svg'), - ]); + $logoutUrl = \OC_User::getLogoutUrl($this->urlGenerator); + if($logoutUrl !== '') { + // Logout + $this->add([ + 'type' => 'settings', + 'id' => 'logout', + 'order' => 99999, + 'href' => $logoutUrl, + 'name' => $l->t('Log out'), + 'icon' => $this->urlGenerator->imagePath('core', 'actions/logout.svg'), + ]); + } if ($this->isSubadmin()) { // User management diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php index 210e428a2e0..9e0ca4b9fee 100644 --- a/lib/private/legacy/user.php +++ b/lib/private/legacy/user.php @@ -281,26 +281,25 @@ class OC_User { } /** - * Supplies an attribute to the logout hyperlink. The default behaviour - * is to return an href with '?logout=true' appended. However, it can - * supply any attribute(s) which are valid for <a>. + * Returns the current logout URL valid for the currently logged-in user * - * @return string with one or more HTML attributes. + * @param \OCP\IURLGenerator $urlGenerator + * @return string */ - public static function getLogoutAttribute() { + public static function getLogoutUrl(\OCP\IURLGenerator $urlGenerator) { $backend = self::findFirstActiveUsedBackend(); if ($backend) { - return $backend->getLogoutAttribute(); + return $backend->getLogoutUrl(); } - $logoutUrl = \OC::$server->getURLGenerator()->linkToRouteAbsolute( + $logoutUrl = $urlGenerator->linkToRouteAbsolute( 'core.login.logout', [ 'requesttoken' => \OCP\Util::callRegister(), ] ); - return 'href="'.$logoutUrl.'"'; + return $logoutUrl; } /** |