diff --git a/apps/desktop/src/auth/login/login.component.ts b/apps/desktop/src/auth/login/login.component.ts index bd7ff1e73b..a5c2f6f3f7 100644 --- a/apps/desktop/src/auth/login/login.component.ts +++ b/apps/desktop/src/auth/login/login.component.ts @@ -98,7 +98,7 @@ export class LoginComponent extends BaseLoginComponent implements OnDestroy { async ngOnInit() { await super.ngOnInit(); - await this.checkSelfHosted(); + await this.getLoginWithDevice(this.loggedEmail); this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => { this.ngZone.run(() => { switch (message.command) { @@ -151,7 +151,7 @@ export class LoginComponent extends BaseLoginComponent implements OnDestroy { // eslint-disable-next-line rxjs/no-async-subscribe childComponent.onSaved.pipe(takeUntil(this.componentDestroyed$)).subscribe(async () => { modal.close(); - await this.checkSelfHosted(); + await this.getLoginWithDevice(this.loggedEmail); }); } @@ -188,10 +188,4 @@ export class LoginComponent extends BaseLoginComponent implements OnDestroy { const email = this.loggedEmail; document.getElementById(email == null || email === "" ? "email" : "masterPassword").focus(); } - - private async checkSelfHosted() { - this.selfHosted = this.environmentService.isSelfHosted(); - - await this.getLoginWithDevice(this.loggedEmail); - } } diff --git a/apps/web/config/selfhosted.json b/apps/web/config/selfhosted.json index 21a9d93a99..8ffbc0f9e5 100644 --- a/apps/web/config/selfhosted.json +++ b/apps/web/config/selfhosted.json @@ -8,6 +8,6 @@ }, "flags": { "secretsManager": false, - "showPasswordless": false + "showPasswordless": true } } diff --git a/libs/angular/src/auth/components/login.component.ts b/libs/angular/src/auth/components/login.component.ts index e882d93894..9dc6ca2f7a 100644 --- a/libs/angular/src/auth/components/login.component.ts +++ b/libs/angular/src/auth/components/login.component.ts @@ -35,7 +35,6 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit onSuccessfulLoginNavigate: () => Promise; onSuccessfulLoginTwoFactorNavigate: () => Promise; onSuccessfulLoginForceResetNavigate: () => Promise; - selfHosted = false; showLoginWithDevice: boolean; validatedEmail = false; paramEmailSet = false; @@ -73,7 +72,6 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit protected loginService: LoginService ) { super(environmentService, i18nService, platformUtilsService); - this.selfHosted = platformUtilsService.isSelfHost(); } get selfHostedDomain() { @@ -295,9 +293,10 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit async getLoginWithDevice(email: string) { try { const deviceIdentifier = await this.appIdService.getAppId(); - const res = await this.devicesApiService.getKnownDevice(email, deviceIdentifier); - //ensure the application is not self-hosted - this.showLoginWithDevice = res && !this.selfHosted; + this.showLoginWithDevice = await this.devicesApiService.getKnownDevice( + email, + deviceIdentifier + ); } catch (e) { this.showLoginWithDevice = false; }