mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
Password reprompt (#929)
* Use passwordRepromptService * Rename passwordPrompt to reprompt. Protect bulk actions * Change card to hidden, minor refactor. * Explicit reprompt value check * Ensure locales are the same on all platforms * Move showPasswordDialog to platformutils * Fix sweet alert validation message margin * Update locale to be the same as browser
This commit is contained in:
@@ -211,6 +211,32 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
|
||||
return confirmed.value;
|
||||
}
|
||||
|
||||
async showPasswordDialog(title: string, body: string, passwordValidation: (value: string) => Promise<boolean>):
|
||||
Promise<boolean> {
|
||||
const result = await Swal.fire({
|
||||
heightAuto: false,
|
||||
title: title,
|
||||
input: 'password',
|
||||
text: 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 passwordValidation(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.i18nService.t('invalidMasterPassword');
|
||||
},
|
||||
});
|
||||
|
||||
return result.isConfirmed;
|
||||
}
|
||||
|
||||
isDev(): boolean {
|
||||
return process.env.ENV === 'development';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user