Removed self-hosted restriction from Login with Device (#5441)

* Removed self-hosted restriction from Login with Device.

* Updated showPasswordless client-side flag to true for self-hosted.

* Linting

* Linting
This commit is contained in:
Todd Martin 2023-06-01 12:38:10 -04:00 committed by GitHub
parent cf63a5680c
commit 23bd5de37c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 14 deletions

View File

@ -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);
}
}

View File

@ -8,6 +8,6 @@
},
"flags": {
"secretsManager": false,
"showPasswordless": false
"showPasswordless": true
}
}

View File

@ -35,7 +35,6 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
onSuccessfulLoginNavigate: () => Promise<any>;
onSuccessfulLoginTwoFactorNavigate: () => Promise<any>;
onSuccessfulLoginForceResetNavigate: () => Promise<any>;
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;
}