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:
parent
1fcac965e9
commit
b83b27832e
1 changed files with 13 additions and 5 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue