mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
Added warning dialog for log out confirmation (#1216)
This commit is contained in:
parent
f636e3a957
commit
0b5cb901aa
@ -1257,5 +1257,11 @@
|
|||||||
"lock": {
|
"lock": {
|
||||||
"message": "Lock",
|
"message": "Lock",
|
||||||
"description": "Verb form: to make secure or inaccesible by"
|
"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>
|
||||||
<div class="box-content-row display-block" appBoxRow>
|
<div class="box-content-row display-block" appBoxRow>
|
||||||
<label for="vaultTimeoutAction">{{'vaultTimeoutAction' | i18n}}</label>
|
<label for="vaultTimeoutAction">{{'vaultTimeoutAction' | i18n}}</label>
|
||||||
<select id="vaultTimeoutAction" name="VaultTimeoutActions" [ngModel]="vaultTimeoutAction"
|
<select #vaultTimeoutActionSelect id="vaultTimeoutAction" name="VaultTimeoutActions"
|
||||||
(ngModelChange)="saveVaultTimeoutAction($event)">
|
[ngModel]="vaultTimeoutAction" (ngModelChange)="saveVaultTimeoutAction($event)">
|
||||||
<option *ngFor="let o of vaultTimeoutActions" [ngValue]="o.value">{{o.name}}</option>
|
<option *ngFor="let o of vaultTimeoutActions" [ngValue]="o.value">{{o.name}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,6 +45,7 @@ const RateUrls = {
|
|||||||
})
|
})
|
||||||
export class SettingsComponent implements OnInit {
|
export class SettingsComponent implements OnInit {
|
||||||
@ViewChild('vaultTimeoutSelect', { read: ElementRef }) vaultTimeoutSelectRef: ElementRef;
|
@ViewChild('vaultTimeoutSelect', { read: ElementRef }) vaultTimeoutSelectRef: ElementRef;
|
||||||
|
@ViewChild('vaultTimeoutActionSelect', { read: ElementRef }) vaultTimeoutActionSelectRef: ElementRef;
|
||||||
vaultTimeouts: any[];
|
vaultTimeouts: any[];
|
||||||
vaultTimeout: number = null;
|
vaultTimeout: number = null;
|
||||||
vaultTimeoutActions: any[];
|
vaultTimeoutActions: any[];
|
||||||
@ -126,6 +127,20 @@ export class SettingsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async saveVaultTimeoutAction(newValue: string) {
|
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;
|
this.vaultTimeoutAction = newValue;
|
||||||
await this.vaultTimeoutService.setVaultTimeoutOptions(this.vaultTimeout != null ? this.vaultTimeout : null,
|
await this.vaultTimeoutService.setVaultTimeoutOptions(this.vaultTimeout != null ? this.vaultTimeout : null,
|
||||||
this.vaultTimeoutAction);
|
this.vaultTimeoutAction);
|
||||||
|
Loading…
Reference in New Issue
Block a user