1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-11-26 23:33:03 +00:00

feat: no ask password if not necessary

This commit is contained in:
Adrien Waksberg 2017-05-22 21:25:56 +02:00
parent 1fcac965e9
commit b83b27832e

View file

@ -126,12 +126,20 @@ module MPW
# Request the GPG password and decrypt the file # Request the GPG password and decrypt the file
def decrypt def decrypt
unless defined?(@mpw) if defined?(@mpw)
@password = ask(I18n.t('display.gpg_password')) { |q| q.echo = false } @mpw.read_data
@mpw = MPW.new(@config.gpg_key, @wallet_file, @password, @config.gpg_exe, @config.pinmode) else
end begin
@mpw = MPW.new(@config.gpg_key, @wallet_file, nil, @config.gpg_exe, @config.pinmode)
@mpw.read_data @mpw.read_data
rescue
@password = ask(I18n.t('display.gpg_password')) { |q| q.echo = false }
@mpw = MPW.new(@config.gpg_key, @wallet_file, @password, @config.gpg_exe, @config.pinmode)
@mpw.read_data
end
end
rescue => e rescue => e
puts "#{I18n.t('display.error')} #11: #{e}".red puts "#{I18n.t('display.error')} #11: #{e}".red
exit 2 exit 2