mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-27 07:33:05 +00:00
fix sync ftp and ssh
This commit is contained in:
parent
298a020e35
commit
a49c975f19
4 changed files with 11 additions and 7 deletions
|
@ -50,7 +50,7 @@ module MPW
|
|||
# Get data on server
|
||||
# @args: gpg_password -> the gpg password
|
||||
# @rtrn: nil if nothing data or error
|
||||
def get(gpg_password)
|
||||
def get(gpg_key, gpg_password)
|
||||
return nil if not @enable
|
||||
|
||||
tmp_file = tmpfile
|
||||
|
@ -59,7 +59,7 @@ module MPW
|
|||
ftp.gettextfile(@path, tmp_file)
|
||||
end
|
||||
|
||||
mpw = MPW.new(tmp_file)
|
||||
mpw = MPW.new(tmp_file, gpg_key)
|
||||
if not mpw.decrypt(gpg_password)
|
||||
@error_msg = mpw.error_msg
|
||||
return nil
|
||||
|
|
|
@ -61,7 +61,7 @@ module MPW
|
|||
# Get data on server
|
||||
# @args: gpg_password -> the gpg password
|
||||
# @rtrn: nil if nothing data or error
|
||||
def get(gpg_password)
|
||||
def get(gpg_key, gpg_password)
|
||||
return nil if not @enable
|
||||
|
||||
msg = nil
|
||||
|
@ -90,7 +90,7 @@ module MPW
|
|||
file << msg['data']
|
||||
end
|
||||
|
||||
mpw = MPW.new(tmp_file, @gpg_key)
|
||||
mpw = MPW.new(tmp_file, gpg_key)
|
||||
if not mpw.decrypt(gpg_password)
|
||||
@error_msg = mpw.error_msg
|
||||
return nil
|
||||
|
|
|
@ -50,7 +50,7 @@ module MPW
|
|||
# Get data on server
|
||||
# @args: gpg_password -> the gpg password
|
||||
# @rtrn: nil if nothing data or error
|
||||
def get(gpg_password)
|
||||
def get(gpg_key, gpg_password)
|
||||
return nil if not @enable
|
||||
|
||||
tmp_file = tmpfile
|
||||
|
@ -58,7 +58,7 @@ module MPW
|
|||
scp.download!(@path, tmp_file)
|
||||
end
|
||||
|
||||
mpw = MPW.new(tmp_file)
|
||||
mpw = MPW.new(tmp_file, gpg_key)
|
||||
if not mpw.decrypt(gpg_password)
|
||||
@error_msg = mpw.error_msg
|
||||
return nil
|
||||
|
|
|
@ -47,15 +47,19 @@ class Cli
|
|||
end
|
||||
|
||||
if @sync.enable
|
||||
if not @mpw.sync(@sync.get(@passwd), @config.last_update)
|
||||
if not @mpw.sync(@sync.get(@config.key, @passwd), @config.last_update)
|
||||
puts "#{I18n.t('display.error')} #2: #{@mpw.error_msg}".red if not @mpw.error_msg.nil?
|
||||
puts "#{I18n.t('display.error')} #3: #{@sync.error_msg}".red if not @sync.error_msg.nil?
|
||||
|
||||
elsif not @sync.update(File.open(@config.file_gpg).read)
|
||||
puts "#{I18n.t('display.error')} #4: #{@sync.error_msg}".red
|
||||
|
||||
elsif not @config.set_last_update
|
||||
puts "#{I18n.t('display.error')} #5: #{@config.error_msg}".red
|
||||
|
||||
elsif not @mpw.encrypt
|
||||
puts "#{I18n.t('display.error')} #6: #{@mpw.error_msg}".red
|
||||
|
||||
else
|
||||
return true
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue