mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
chore(authentication): minor improvements
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user