diff --git a/webapp/packages/authentication/src/AuthMenuService.ts b/webapp/packages/authentication/src/AuthMenuService.ts index 2513db1226..0ed1ee92a4 100644 --- a/webapp/packages/authentication/src/AuthMenuService.ts +++ b/webapp/packages/authentication/src/AuthMenuService.ts @@ -42,7 +42,7 @@ export class AuthMenuService { SettingsMenuService.settingsMenuToken, { id: 'logout', - order: 0, + order: Number.MAX_SAFE_INTEGER, isHidden: () => !this.serverService.config.data?.authenticationEnabled || !this.authInfoService.userInfo, title: 'authentication_logout', onClick: this.logout.bind(this), diff --git a/webapp/packages/authentication/src/AuthenticationService.ts b/webapp/packages/authentication/src/AuthenticationService.ts index de99650183..7ba584a671 100644 --- a/webapp/packages/authentication/src/AuthenticationService.ts +++ b/webapp/packages/authentication/src/AuthenticationService.ts @@ -21,20 +21,22 @@ export class AuthenticationService { ) { } async auth() { - if (await this.isForceAuthentication()) { - await this.authDialogService.showLoginForm(true); - } - } - - async isForceAuthentication() { const config = await this.serverService.config.load(); if (!config) { throw new Error('Can\'t configure Authentication'); } - const userInfo = await this.authInfoService.updateAuthInfo(); - return !config.anonymousAccessEnabled - && config.authenticationEnabled - && !userInfo; + if (!config.authenticationEnabled) { + return; + } + + const userInfo = await this.authInfoService.updateAuthInfo(); + if (userInfo) { + return; + } + + if (!config.anonymousAccessEnabled) { + await this.authDialogService.showLoginForm(true); + } } }