Skip to content

Commit 9832bdd

Browse files
authored
Merge pull request #63706 from nextcloud/backport/62235/stable32
[stable32] Improve logout url generation
2 parents 445198a + 1ae652f commit 9832bdd

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

core/AppInfo/Application.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,4 @@ public function register(IRegistrationContext $context): void {
9898
public function boot(IBootContext $context): void {
9999
// ...
100100
}
101-
102101
}

lib/private/NavigationManager.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -309,17 +309,15 @@ private function init(bool $resolveClosures = true): void {
309309
}
310310

311311
$logoutUrl = \OC_User::getLogoutUrl($this->urlGenerator);
312-
if ($logoutUrl !== '') {
313-
// Logout
314-
$this->add([
315-
'type' => 'settings',
316-
'id' => 'logout',
317-
'order' => 99999,
318-
'href' => $logoutUrl,
319-
'name' => $l->t('Log out'),
320-
'icon' => $this->urlGenerator->imagePath('core', 'actions/logout.svg'),
321-
]);
322-
}
312+
// Logout
313+
$this->add([
314+
'type' => 'settings',
315+
'id' => 'logout',
316+
'order' => 99999,
317+
'href' => $logoutUrl,
318+
'name' => $l->t('Log out'),
319+
'icon' => $this->urlGenerator->imagePath('core', 'actions/logout.svg'),
320+
]);
323321

324322
if ($this->isSubadmin()) {
325323
// User management

lib/private/legacy/OC_User.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public static function isIncognitoMode() {
282282
* Returns the current logout URL valid for the currently logged-in user
283283
*
284284
* @param \OCP\IURLGenerator $urlGenerator
285-
* @return string
285+
* @return non-empty-string
286286
*/
287287
public static function getLogoutUrl(\OCP\IURLGenerator $urlGenerator) {
288288
$backend = self::findFirstActiveUsedBackend();
@@ -294,7 +294,10 @@ public static function getLogoutUrl(\OCP\IURLGenerator $urlGenerator) {
294294
if ($user instanceof IUser) {
295295
$backend = $user->getBackend();
296296
if ($backend instanceof \OCP\User\Backend\ICustomLogout) {
297-
return $backend->getLogoutUrl();
297+
$logoutUrl = $backend->getLogoutUrl();
298+
if ($logoutUrl !== '') {
299+
return $logoutUrl;
300+
}
298301
}
299302
}
300303

lib/public/Authentication/IApacheBackend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function isSessionActive();
2727
/**
2828
* Gets the current logout URL
2929
*
30-
* @return string
30+
* @return non-empty-string
3131
* @since 12.0.3
3232
*/
3333
public function getLogoutUrl();

0 commit comments

Comments
 (0)