mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-28 12:35:40 +01:00
Add setting for disabling auto prompt of biometrics (#873)
* Add setting for disabling auto prompt of biometrics * Ensure window is visible before prompting for biometrics
This commit is contained in:
parent
a712917f47
commit
af5898a001
2
jslib
2
jslib
@ -1 +1 @@
|
||||
Subproject commit e2cb9b6bef54a1bc04174aa9eec02ea800962887
|
||||
Subproject commit 1b8f6aace247d226455f2ae510cd99eac91ff8b1
|
@ -7,6 +7,7 @@ import {
|
||||
ActivatedRoute,
|
||||
Router,
|
||||
} from '@angular/router';
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
import { ApiService } from 'jslib/abstractions/api.service';
|
||||
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
||||
@ -23,6 +24,8 @@ import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
||||
|
||||
import { LockComponent as BaseLockComponent } from 'jslib/angular/components/lock.component';
|
||||
|
||||
import { ElectronConstants } from 'jslib/electron/electronConstants';
|
||||
|
||||
const BroadcasterSubscriptionId = 'LockComponent';
|
||||
|
||||
@Component({
|
||||
@ -43,9 +46,15 @@ export class LockComponent extends BaseLockComponent implements OnDestroy {
|
||||
|
||||
async ngOnInit() {
|
||||
await super.ngOnInit();
|
||||
const autoPromptBiometric = !await this.storageService.get<boolean>(ElectronConstants.noAutoPromptBiometrics);
|
||||
|
||||
this.route.queryParams.subscribe(params => {
|
||||
if (this.supportsBiometric && params.promptBiometric) {
|
||||
setTimeout(() => this.unlockBiometric(), 1000);
|
||||
if (this.supportsBiometric && params.promptBiometric && autoPromptBiometric) {
|
||||
setTimeout(async() => {
|
||||
if (await ipcRenderer.invoke('windowVisible')) {
|
||||
this.unlockBiometric();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
|
||||
|
@ -52,6 +52,15 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" *ngIf="supportsBiometric">
|
||||
<div class="checkbox">
|
||||
<label for="noAutoPromptBiometrics">
|
||||
<input id="noAutoPromptBiometrics" type="checkbox" name="noAutoPromptBiometrics" [(ngModel)]="noAutoPromptBiometrics"
|
||||
[disabled]="!biometric" (change)="updateNoAutoPromptBiometrics()">
|
||||
{{noAutoPromptBiometricsText | i18n}}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
|
@ -50,6 +50,8 @@ export class SettingsComponent implements OnInit {
|
||||
supportsBiometric: boolean;
|
||||
biometric: boolean;
|
||||
biometricText: string;
|
||||
noAutoPromptBiometrics: boolean;
|
||||
noAutoPromptBiometricsText: string;
|
||||
alwaysShowDock: boolean;
|
||||
showAlwaysShowDock: boolean = false;
|
||||
openAtLogin: boolean;
|
||||
@ -162,6 +164,8 @@ export class SettingsComponent implements OnInit {
|
||||
this.supportsBiometric = await this.platformUtilsService.supportsBiometric();
|
||||
this.biometric = await this.vaultTimeoutService.isBiometricLockSet();
|
||||
this.biometricText = await this.storageService.get<string>(ConstantsService.biometricText);
|
||||
this.noAutoPromptBiometrics = await this.storageService.get<boolean>(ElectronConstants.noAutoPromptBiometrics);
|
||||
this.noAutoPromptBiometricsText = await this.storageService.get<string>(ElectronConstants.noAutoPromptBiometricsText);
|
||||
this.alwaysShowDock = await this.storageService.get<boolean>(ElectronConstants.alwaysShowDock);
|
||||
this.showAlwaysShowDock = this.platformUtilsService.getDevice() === DeviceType.MacOsDesktop;
|
||||
this.openAtLogin = await this.storageService.get<boolean>(ElectronConstants.openAtLogin);
|
||||
@ -255,11 +259,25 @@ export class SettingsComponent implements OnInit {
|
||||
await this.storageService.save(ConstantsService.biometricUnlockKey, true);
|
||||
} else {
|
||||
await this.storageService.remove(ConstantsService.biometricUnlockKey);
|
||||
await this.storageService.remove(ElectronConstants.noAutoPromptBiometrics);
|
||||
this.noAutoPromptBiometrics = false;
|
||||
}
|
||||
this.vaultTimeoutService.biometricLocked = false;
|
||||
await this.cryptoService.toggleKey();
|
||||
}
|
||||
|
||||
async updateNoAutoPromptBiometrics() {
|
||||
if (!this.biometric) {
|
||||
this.noAutoPromptBiometrics = false;
|
||||
}
|
||||
|
||||
if (this.noAutoPromptBiometrics) {
|
||||
await this.storageService.save(ElectronConstants.noAutoPromptBiometrics, true);
|
||||
} else {
|
||||
await this.storageService.remove(ElectronConstants.noAutoPromptBiometrics);
|
||||
}
|
||||
}
|
||||
|
||||
async saveFavicons() {
|
||||
await this.storageService.save(ConstantsService.disableFaviconKey, this.disableFavicons);
|
||||
await this.stateService.save(ConstantsService.disableFaviconKey, this.disableFavicons);
|
||||
|
@ -1297,6 +1297,12 @@
|
||||
"touchIdConsentMessage": {
|
||||
"message": "unlock your vault"
|
||||
},
|
||||
"noAutoPromptWindowsHello": {
|
||||
"message": "Do not prompt for Windows Hello on launch."
|
||||
},
|
||||
"noAutoPromptTouchId": {
|
||||
"message": "Do not prompt for Touch ID on launch."
|
||||
},
|
||||
"lockWithMasterPassOnRestart": {
|
||||
"message": "Lock with master password on restart"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user