mirror of
https://github.com/bitwarden/browser
synced 2024-12-24 17:11:55 +01: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:
parent
0a4b8b15bc
commit
acbd789c2b
@ -59,7 +59,11 @@
|
||||
[(ngModel)]="biometric"
|
||||
/>
|
||||
</div>
|
||||
<div class="box-content-row box-content-row-checkbox" appBoxRow *ngIf="supportsBiometric">
|
||||
<div
|
||||
class="box-content-row box-content-row-checkbox"
|
||||
appBoxRow
|
||||
*ngIf="supportsBiometric && biometric"
|
||||
>
|
||||
<label for="autoBiometricsPrompt">{{ "enableAutoBiometricsPrompt" | i18n }}</label>
|
||||
<input
|
||||
id="autoBiometricsPrompt"
|
||||
|
@ -114,9 +114,7 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
this.supportsBiometric = await this.platformUtilsService.supportsBiometric();
|
||||
this.biometric = await this.vaultTimeoutService.isBiometricLockSet();
|
||||
const disableAutoBiometricsPrompt =
|
||||
(await this.stateService.getDisableAutoBiometricsPrompt()) ?? true;
|
||||
this.enableAutoBiometricsPrompt = !disableAutoBiometricsPrompt;
|
||||
this.enableAutoBiometricsPrompt = !(await this.stateService.getDisableAutoBiometricsPrompt());
|
||||
this.showChangeMasterPass = !(await this.keyConnectorService.getUsesKeyConnector());
|
||||
}
|
||||
|
||||
|
@ -87,14 +87,14 @@
|
||||
id="biometric"
|
||||
type="checkbox"
|
||||
name="biometric"
|
||||
[checked]="biometric"
|
||||
(change)="updateBiometric()"
|
||||
[ngModel]="biometric"
|
||||
(ngModelChange)="updateBiometric($event)"
|
||||
/>
|
||||
{{ biometricText | i18n }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" *ngIf="supportsBiometric">
|
||||
<div class="form-group" *ngIf="supportsBiometric && biometric">
|
||||
<div class="checkbox">
|
||||
<label for="autoPromptBiometrics">
|
||||
<input
|
||||
@ -102,7 +102,6 @@
|
||||
type="checkbox"
|
||||
name="autoPromptBiometrics"
|
||||
[(ngModel)]="autoPromptBiometrics"
|
||||
[disabled]="!biometric"
|
||||
(change)="updateAutoPromptBiometrics()"
|
||||
/>
|
||||
{{ autoPromptBiometricsText | i18n }}
|
||||
|
@ -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 {
|
||||
|
@ -934,7 +934,7 @@
|
||||
"message": "Always show an icon in the system tray."
|
||||
},
|
||||
"startToTray": {
|
||||
"message": "Start To tray icon"
|
||||
"message": "Start to tray icon"
|
||||
},
|
||||
"startToTrayDesc": {
|
||||
"message": "When the application is first started, only show an icon in the system tray."
|
||||
@ -1553,7 +1553,7 @@
|
||||
"message": "Allow browser integration"
|
||||
},
|
||||
"enableBrowserIntegrationDesc": {
|
||||
"message": "Browser integration is used for biometrics in browser."
|
||||
"message": "Used for biometrics in browser."
|
||||
},
|
||||
"browserIntegrationUnsupportedTitle": {
|
||||
"message": "Browser integration not supported"
|
||||
|
Loading…
Reference in New Issue
Block a user