mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 06:43:35 +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:
@@ -59,7 +59,11 @@
|
|||||||
[(ngModel)]="biometric"
|
[(ngModel)]="biometric"
|
||||||
/>
|
/>
|
||||||
</div>
|
</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>
|
<label for="autoBiometricsPrompt">{{ "enableAutoBiometricsPrompt" | i18n }}</label>
|
||||||
<input
|
<input
|
||||||
id="autoBiometricsPrompt"
|
id="autoBiometricsPrompt"
|
||||||
|
|||||||
@@ -114,9 +114,7 @@ export class SettingsComponent implements OnInit {
|
|||||||
|
|
||||||
this.supportsBiometric = await this.platformUtilsService.supportsBiometric();
|
this.supportsBiometric = await this.platformUtilsService.supportsBiometric();
|
||||||
this.biometric = await this.vaultTimeoutService.isBiometricLockSet();
|
this.biometric = await this.vaultTimeoutService.isBiometricLockSet();
|
||||||
const disableAutoBiometricsPrompt =
|
this.enableAutoBiometricsPrompt = !(await this.stateService.getDisableAutoBiometricsPrompt());
|
||||||
(await this.stateService.getDisableAutoBiometricsPrompt()) ?? true;
|
|
||||||
this.enableAutoBiometricsPrompt = !disableAutoBiometricsPrompt;
|
|
||||||
this.showChangeMasterPass = !(await this.keyConnectorService.getUsesKeyConnector());
|
this.showChangeMasterPass = !(await this.keyConnectorService.getUsesKeyConnector());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,14 +87,14 @@
|
|||||||
id="biometric"
|
id="biometric"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="biometric"
|
name="biometric"
|
||||||
[checked]="biometric"
|
[ngModel]="biometric"
|
||||||
(change)="updateBiometric()"
|
(ngModelChange)="updateBiometric($event)"
|
||||||
/>
|
/>
|
||||||
{{ biometricText | i18n }}
|
{{ biometricText | i18n }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" *ngIf="supportsBiometric">
|
<div class="form-group" *ngIf="supportsBiometric && biometric">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label for="autoPromptBiometrics">
|
<label for="autoPromptBiometrics">
|
||||||
<input
|
<input
|
||||||
@@ -102,7 +102,6 @@
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="autoPromptBiometrics"
|
name="autoPromptBiometrics"
|
||||||
[(ngModel)]="autoPromptBiometrics"
|
[(ngModel)]="autoPromptBiometrics"
|
||||||
[disabled]="!biometric"
|
|
||||||
(change)="updateAutoPromptBiometrics()"
|
(change)="updateAutoPromptBiometrics()"
|
||||||
/>
|
/>
|
||||||
{{ autoPromptBiometricsText | i18n }}
|
{{ autoPromptBiometricsText | i18n }}
|
||||||
|
|||||||
@@ -265,32 +265,34 @@ export class SettingsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateBiometric() {
|
async updateBiometric(newValue: boolean) {
|
||||||
const current = this.biometric;
|
// NOTE: A bug in angular causes [ngModel] to not reflect the backing field value
|
||||||
if (this.biometric) {
|
// 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;
|
this.biometric = false;
|
||||||
} else if (this.supportsBiometric) {
|
await this.stateService.setBiometricUnlock(null);
|
||||||
this.biometric = await this.platformUtilsService.authenticateBiometric();
|
await this.stateService.setBiometricLocked(false);
|
||||||
}
|
await this.cryptoService.toggleKey();
|
||||||
if (this.biometric === current) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.biometric) {
|
|
||||||
await this.stateService.setBiometricUnlock(true);
|
const authResult = await this.platformUtilsService.authenticateBiometric();
|
||||||
} else {
|
|
||||||
await this.stateService.setBiometricUnlock(null);
|
if (!authResult) {
|
||||||
await this.stateService.setNoAutoPromptBiometrics(null);
|
this.biometric = false;
|
||||||
this.autoPromptBiometrics = false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.biometric = true;
|
||||||
|
await this.stateService.setBiometricUnlock(true);
|
||||||
await this.stateService.setBiometricLocked(false);
|
await this.stateService.setBiometricLocked(false);
|
||||||
await this.cryptoService.toggleKey();
|
await this.cryptoService.toggleKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateAutoPromptBiometrics() {
|
async updateAutoPromptBiometrics() {
|
||||||
if (!this.biometric) {
|
|
||||||
this.autoPromptBiometrics = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.autoPromptBiometrics) {
|
if (this.autoPromptBiometrics) {
|
||||||
await this.stateService.setNoAutoPromptBiometrics(null);
|
await this.stateService.setNoAutoPromptBiometrics(null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -934,7 +934,7 @@
|
|||||||
"message": "Always show an icon in the system tray."
|
"message": "Always show an icon in the system tray."
|
||||||
},
|
},
|
||||||
"startToTray": {
|
"startToTray": {
|
||||||
"message": "Start To tray icon"
|
"message": "Start to tray icon"
|
||||||
},
|
},
|
||||||
"startToTrayDesc": {
|
"startToTrayDesc": {
|
||||||
"message": "When the application is first started, only show an icon in the system tray."
|
"message": "When the application is first started, only show an icon in the system tray."
|
||||||
@@ -1553,7 +1553,7 @@
|
|||||||
"message": "Allow browser integration"
|
"message": "Allow browser integration"
|
||||||
},
|
},
|
||||||
"enableBrowserIntegrationDesc": {
|
"enableBrowserIntegrationDesc": {
|
||||||
"message": "Browser integration is used for biometrics in browser."
|
"message": "Used for biometrics in browser."
|
||||||
},
|
},
|
||||||
"browserIntegrationUnsupportedTitle": {
|
"browserIntegrationUnsupportedTitle": {
|
||||||
"message": "Browser integration not supported"
|
"message": "Browser integration not supported"
|
||||||
|
|||||||
Reference in New Issue
Block a user