Skip to content

Commit e1bfaf6

Browse files
committed
Fix nothing showing when biometrics unavailable
1 parent 86b213a commit e1bfaf6

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

libs/key-management-ui/src/lock/components/lock.component.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export class LockComponent implements OnInit, OnDestroy {
276276
this.lockComponentService.getAvailableUnlockOptions$(activeAccount.id),
277277
);
278278

279-
this.setDefaultActiveUnlockOption(this.unlockOptions);
279+
await this.setDefaultActiveUnlockOption(this.unlockOptions);
280280

281281
if (this.unlockOptions?.biometrics.enabled) {
282282
await this.handleBiometricsUnlockEnabled();
@@ -299,14 +299,26 @@ export class LockComponent implements OnInit, OnDestroy {
299299
});
300300
}
301301

302-
private setDefaultActiveUnlockOption(unlockOptions: UnlockOptions | null) {
302+
private async setDefaultActiveUnlockOption(unlockOptions: UnlockOptions | null) {
303+
const biometricsStatus = await this.biometricService.getBiometricsStatusForUser(
304+
this.activeAccount.id,
305+
);
306+
303307
// Priorities should be Biometrics > Pin > Master Password for speed
304308
if (unlockOptions?.biometrics.enabled) {
305309
this.activeUnlockOption = UnlockOption.Biometrics;
306310
} else if (unlockOptions?.pin.enabled) {
307311
this.activeUnlockOption = UnlockOption.Pin;
308312
} else if (unlockOptions?.masterPassword.enabled) {
309313
this.activeUnlockOption = UnlockOption.MasterPassword;
314+
// If biometrics is temporarily unavailable for masterpassword-less users, but they have biometrics configured,
315+
// then show the biometrics screen so the user knows why they can't unlock, and to give them the option to log out.
316+
} else if (
317+
biometricsStatus === BiometricsStatus.HardwareUnavailable ||
318+
biometricsStatus === BiometricsStatus.DesktopDisconnected ||
319+
biometricsStatus === BiometricsStatus.NotEnabledInConnectedDesktopApp
320+
) {
321+
this.activeUnlockOption = UnlockOption.Biometrics;
310322
}
311323
}
312324

0 commit comments

Comments
 (0)