mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-26 23:33:03 +00:00
ask if you want create gpg key
This commit is contained in:
parent
f9f06f245c
commit
ba297c3d7d
4 changed files with 16 additions and 0 deletions
|
@ -99,6 +99,11 @@ module MPW
|
|||
end
|
||||
|
||||
# Setup a new gpg key
|
||||
# @args: password -> the GPG key password
|
||||
# name -> the name of user
|
||||
# length -> length of the GPG key
|
||||
# expire -> the time of expire to GPG key
|
||||
# @rtrn: true if the GPG key is create, else false
|
||||
def setup_gpg_key(password, name, length = 2048, expire = 0)
|
||||
if name.nil? || name.empty?
|
||||
@error_msg = "#{I18n.t('error.config.genkey_gpg.name')}"
|
||||
|
|
|
@ -118,6 +118,13 @@ class Cli
|
|||
def setup_gpg_key
|
||||
puts I18n.t('form.setup_gpg_key.title')
|
||||
puts '--------------------'
|
||||
ask = ask(I18n.t('form.setup_gpg_key.ask')).to_s
|
||||
|
||||
if !['Y', 'y', 'O', 'o'].include?(ask)
|
||||
puts I18n.t('form.setup_gpg_key.no_create')
|
||||
exit 2
|
||||
end
|
||||
|
||||
name = ask(I18n.t('form.setup_gpg_key.name')).to_s
|
||||
password = ask(I18n.t('form.setup_gpg_key.password')).to_s
|
||||
length = ask(I18n.t('form.setup_gpg_key.length')).to_s
|
||||
|
|
|
@ -83,6 +83,8 @@ en:
|
|||
valid: "The config file has been created!"
|
||||
setup_gpg_key:
|
||||
title: "Setup a GPG key"
|
||||
ask: "Do you want create your GPG key ? (Y/n)"
|
||||
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: "
|
||||
length: "Size of the GPG key [default=2048]: "
|
||||
|
|
|
@ -83,6 +83,8 @@ fr:
|
|||
valid: "Le fichier de configuration a bien été créé!"
|
||||
setup_gpg_key:
|
||||
title: "Configuration d'une clé GPG"
|
||||
ask: "Voulez vous créer votre clé GPG ? (O/n)"
|
||||
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: "
|
||||
length: "Taille de la clé GPG [défaut=2048]: "
|
||||
|
|
Loading…
Reference in a new issue