mirror of
https://github.com/nishiki/manage-password.git
synced 2024-10-27 02:33:19 +00:00
fix bug setup
This commit is contained in:
parent
5976147405
commit
60eef298ce
3 changed files with 4 additions and 5 deletions
|
@ -31,7 +31,7 @@ class Cli
|
||||||
file_pwd = ask("Enter te path to password file [default=#{Dir.home()}/.mpw.pwd]: ")
|
file_pwd = ask("Enter te path to password file [default=#{Dir.home()}/.mpw.pwd]: ")
|
||||||
timeout_pwd = ask("Enter the timeout (in seconde) to GPG password [default=300]: ")
|
timeout_pwd = ask("Enter the timeout (in seconde) to GPG password [default=300]: ")
|
||||||
|
|
||||||
if setup(key, file_gpg, file_pwd, timeout_pwd)
|
if @m.setup(key, file_gpg, file_pwd, timeout_pwd)
|
||||||
puts "The config file has been created!"
|
puts "The config file has been created!"
|
||||||
else
|
else
|
||||||
puts "ERROR: #{@m.error_msg}"
|
puts "ERROR: #{@m.error_msg}"
|
||||||
|
@ -114,7 +114,6 @@ class Cli
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove(id, force=false)
|
def remove(id, force=false)
|
||||||
|
|
||||||
if not force
|
if not force
|
||||||
confirm = ask("Are you sur to remove the item: #{id} ? (y/N) ")
|
confirm = ask("Are you sur to remove the item: #{id} ? (y/N) ")
|
||||||
if confirm =~ /^(y|yes|YES|Yes|Y)$/
|
if confirm =~ /^(y|yes|YES|Yes|Y)$/
|
4
MPW.rb
4
MPW.rb
|
@ -133,10 +133,10 @@ class MPW
|
||||||
# Check if a password it saved
|
# Check if a password it saved
|
||||||
# @rtrn: true if a password exist in the password file
|
# @rtrn: true if a password exist in the password file
|
||||||
def checkFilePassword()
|
def checkFilePassword()
|
||||||
if File.exist?(@file_pwd) && File.stat(@file_pwd).mtime.to_i + @timeout_pwd < Time.now.to_i
|
if !@file_pwd.nil? && File.exist?(@file_pwd) && File.stat(@file_pwd).mtime.to_i + @timeout_pwd < Time.now.to_i
|
||||||
File.delete(@file_pwd)
|
File.delete(@file_pwd)
|
||||||
return false
|
return false
|
||||||
elsif File.exist?(@file_pwd)
|
elsif !@file_pwd.nil? && File.exist?(@file_pwd)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
|
|
2
mpw
2
mpw
|
@ -8,7 +8,7 @@ require 'optparse'
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
|
|
||||||
APP_ROOT = File.dirname(Pathname.new(__FILE__).realpath)
|
APP_ROOT = File.dirname(Pathname.new(__FILE__).realpath)
|
||||||
require "#{APP_ROOT}/cli.rb"
|
require "#{APP_ROOT}/Cli.rb"
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
|
|
Loading…
Reference in a new issue