CLI: confirm encryption password (#1937)

Successful flow:
https://gyazo.com/354ca9ea412ffe3756ee77938d544341

Flow with error (non-matching passwords):
https://gyazo.com/9adda69278e3631da33d9fb366815d04
pull/1941/head
Nathan Leiby 2019-10-01 23:48:58 -07:00 committed by Laurent Cozic
parent 0fb5b35212
commit 438c448ef7
1 changed files with 9 additions and 1 deletions

View File

@ -50,7 +50,15 @@ class Command extends BaseCommand {
this.stdout(_('Operation cancelled'));
return;
}
const password2 = await this.prompt(_('Confirm master password:'), { type: 'string', secure: true });
if (!password2) {
this.stdout(_('Operation cancelled'));
return;
}
if (password !== password2) {
this.stdout(_('Passwords did not match!'));
return;
}
await EncryptionService.instance().generateMasterKeyAndEnableEncryption(password);
return;
}