mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-28 12:45:45 +01:00
Added warning dialog for log out confirmation (#1216)
This commit is contained in:
parent
f636e3a957
commit
0b5cb901aa
@ -1257,5 +1257,11 @@
|
||||
"lock": {
|
||||
"message": "Lock",
|
||||
"description": "Verb form: to make secure or inaccesible by"
|
||||
},
|
||||
"vaultTimeoutLogOutConfirmation": {
|
||||
"message": "Logging out will remove all access to your vault and requires online authentication after the timeout period. Are you sure you want to use this setting?"
|
||||
},
|
||||
"vaultTimeoutLogOutConfirmationTitle": {
|
||||
"message": "Timeout Action Confirmation"
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,8 @@
|
||||
</div>
|
||||
<div class="box-content-row display-block" appBoxRow>
|
||||
<label for="vaultTimeoutAction">{{'vaultTimeoutAction' | i18n}}</label>
|
||||
<select id="vaultTimeoutAction" name="VaultTimeoutActions" [ngModel]="vaultTimeoutAction"
|
||||
(ngModelChange)="saveVaultTimeoutAction($event)">
|
||||
<select #vaultTimeoutActionSelect id="vaultTimeoutAction" name="VaultTimeoutActions"
|
||||
[ngModel]="vaultTimeoutAction" (ngModelChange)="saveVaultTimeoutAction($event)">
|
||||
<option *ngFor="let o of vaultTimeoutActions" [ngValue]="o.value">{{o.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -45,6 +45,7 @@ const RateUrls = {
|
||||
})
|
||||
export class SettingsComponent implements OnInit {
|
||||
@ViewChild('vaultTimeoutSelect', { read: ElementRef }) vaultTimeoutSelectRef: ElementRef;
|
||||
@ViewChild('vaultTimeoutActionSelect', { read: ElementRef }) vaultTimeoutActionSelectRef: ElementRef;
|
||||
vaultTimeouts: any[];
|
||||
vaultTimeout: number = null;
|
||||
vaultTimeoutActions: any[];
|
||||
@ -126,6 +127,20 @@ export class SettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
async saveVaultTimeoutAction(newValue: string) {
|
||||
if (newValue === 'logOut') {
|
||||
const confirmed = await this.platformUtilsService.showDialog(
|
||||
this.i18nService.t('vaultTimeoutLogOutConfirmation'),
|
||||
this.i18nService.t('vaultTimeoutLogOutConfirmationTitle'),
|
||||
this.i18nService.t('yes'), this.i18nService.t('cancel'), 'warning');
|
||||
if (!confirmed) {
|
||||
this.vaultTimeoutActions.forEach((option: any, i) => {
|
||||
if (option.value === this.vaultTimeoutAction) {
|
||||
this.vaultTimeoutActionSelectRef.nativeElement.value = i + ': ' + this.vaultTimeoutAction;
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.vaultTimeoutAction = newValue;
|
||||
await this.vaultTimeoutService.setVaultTimeoutOptions(this.vaultTimeout != null ? this.vaultTimeout : null,
|
||||
this.vaultTimeoutAction);
|
||||
|
Loading…
Reference in New Issue
Block a user