1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

Add password show/hide to reprompt (#1902)

Co-authored-by: Addison Beck <abeck@bitwarden.com>
This commit is contained in:
Oscar Hinton
2021-08-27 15:27:22 +02:00
committed by GitHub
parent b13fae4849
commit a1f7e07f09
12 changed files with 418 additions and 62 deletions

View File

@@ -106,8 +106,6 @@ export class AppComponent implements OnInit {
});
} else if (msg.command === 'showDialog') {
await this.showDialog(msg);
} else if (msg.command === 'showPasswordDialog') {
await this.showPasswordDialog(msg);
} else if (msg.command === 'showToast') {
this.ngZone.run(() => {
this.showToast(msg);
@@ -251,30 +249,4 @@ export class AppComponent implements OnInit {
confirmed: confirmed.value,
});
}
private async showPasswordDialog(msg: any) {
const platformUtils = this.platformUtilsService as BrowserPlatformUtilsService;
const result = await Swal.fire({
heightAuto: false,
titleText: msg.title,
input: 'password',
text: msg.body,
confirmButtonText: this.i18nService.t('ok'),
showCancelButton: true,
cancelButtonText: this.i18nService.t('cancel'),
inputAttributes: {
autocapitalize: 'off',
autocorrect: 'off',
},
inputValidator: async (value: string): Promise<any> => {
if (await platformUtils.resolvePasswordDialogPromise(msg.dialogId, false, value)) {
return false;
}
return this.i18nService.t('invalidMasterPassword');
},
});
platformUtils.resolvePasswordDialogPromise(msg.dialogId, true, null);
}
}