diff --git a/MPW/UI/Cli.rb b/MPW/UI/Cli.rb index baf522e..d59519a 100644 --- a/MPW/UI/Cli.rb +++ b/MPW/UI/Cli.rb @@ -126,9 +126,17 @@ class Cli end name = ask(I18n.t('form.setup_gpg_key.name')).to_s - password = ask(I18n.t('form.setup_gpg_key.password')).to_s + password = ask(I18n.t('form.setup_gpg_key.password')) {|q| q.echo = false} + confirm = ask(I18n.t('form.setup_gpg_key.confirm_password')) {|q| q.echo = false} + + if password != confirm + puts I18n.t('form.setup_gpg_key.error_password') + exit 2 + end + length = ask(I18n.t('form.setup_gpg_key.length')).to_s expire = ask(I18n.t('form.setup_gpg_key.expire')).to_s + password = password.to_s length = length.nil? || length.empty? ? 2048 : length.to_i expire = expire.nil? || expire.empty? ? 0 : expire.to_i diff --git a/i18n/cli/en.yml b/i18n/cli/en.yml index 1d29686..082c2f1 100644 --- a/i18n/cli/en.yml +++ b/i18n/cli/en.yml @@ -88,6 +88,8 @@ en: no_create: "You must create manually your GPG key or relaunch the software." name: "Your name and lastname: " password: "A password for the GPG key: " + confirm_password: "Confirm your password: " + error_password: "Your passwords aren't identical!" length: "Size of the GPG key [default=2048]: " expire: "Expire time of the GPG key [default=0 (unlimited)]: " wait: "Please waiting during the GPG key generate, this process can take few minutes." diff --git a/i18n/cli/fr.yml b/i18n/cli/fr.yml index 1ea2e57..146ca02 100644 --- a/i18n/cli/fr.yml +++ b/i18n/cli/fr.yml @@ -88,6 +88,8 @@ fr: no_create: "Veuillez créer manuellement votre clé GPG ou relancer le logiciel." name: "Votre nom et prénom: " password: "Mot de passe de la clé GPG: " + confirm_password: "Retapez votre mot de passe: " + error_password: "Vos deux mots de passes ne sont pas identiques!" length: "Taille de la clé GPG [défaut=2048]: " expire: "Expiration de la clé GPG [défaut=0 (illimité)]: " wait: "Veuillez patienter durant la génération de votre clé GPG, ce processus peut prendre quelques minutes."