1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00

[PS-683] Fix missed defaults and sentence cases (#3095)

* chore: remove superfluous default

* fix: translations

* feat: dont update auto biometric but hide the option

* feat: hide auto biometrics if biometrics are disabled

* refactor: make updateBiometric easier to read and add bug note

* chore: add comment about bug getting resolved

* refactor: merge two if-cases
This commit is contained in:
Andreas Coroiu
2022-07-19 14:51:08 +02:00
committed by GitHub
parent 0a4b8b15bc
commit acbd789c2b
5 changed files with 30 additions and 27 deletions

View File

@@ -265,32 +265,34 @@ export class SettingsComponent implements OnInit {
}
}
async updateBiometric() {
const current = this.biometric;
if (this.biometric) {
async updateBiometric(newValue: boolean) {
// NOTE: A bug in angular causes [ngModel] to not reflect the backing field value
// causing the checkbox to remain checked even if authentication fails.
// The bug should resolve itself once the angular issue is resolved.
// See: https://github.com/angular/angular/issues/13063
if (!newValue || !this.supportsBiometric) {
this.biometric = false;
} else if (this.supportsBiometric) {
this.biometric = await this.platformUtilsService.authenticateBiometric();
}
if (this.biometric === current) {
await this.stateService.setBiometricUnlock(null);
await this.stateService.setBiometricLocked(false);
await this.cryptoService.toggleKey();
return;
}
if (this.biometric) {
await this.stateService.setBiometricUnlock(true);
} else {
await this.stateService.setBiometricUnlock(null);
await this.stateService.setNoAutoPromptBiometrics(null);
this.autoPromptBiometrics = false;
const authResult = await this.platformUtilsService.authenticateBiometric();
if (!authResult) {
this.biometric = false;
return;
}
this.biometric = true;
await this.stateService.setBiometricUnlock(true);
await this.stateService.setBiometricLocked(false);
await this.cryptoService.toggleKey();
}
async updateAutoPromptBiometrics() {
if (!this.biometric) {
this.autoPromptBiometrics = false;
}
if (this.autoPromptBiometrics) {
await this.stateService.setNoAutoPromptBiometrics(null);
} else {