1
0
Fork 0
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:
nishiki 2013-07-18 22:12:45 +02:00
parent 5976147405
commit 60eef298ce
3 changed files with 4 additions and 5 deletions

View file

@ -31,7 +31,7 @@ class Cli
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]: ")
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!"
else
puts "ERROR: #{@m.error_msg}"
@ -114,7 +114,6 @@ class Cli
end
def remove(id, force=false)
if not force
confirm = ask("Are you sur to remove the item: #{id} ? (y/N) ")
if confirm =~ /^(y|yes|YES|Yes|Y)$/

4
MPW.rb
View file

@ -133,10 +133,10 @@ class MPW
# Check if a password it saved
# @rtrn: true if a password exist in the password file
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)
return false
elsif File.exist?(@file_pwd)
elsif !@file_pwd.nil? && File.exist?(@file_pwd)
return true
else
return false

2
mpw
View file

@ -8,7 +8,7 @@ require 'optparse'
require 'pathname'
APP_ROOT = File.dirname(Pathname.new(__FILE__).realpath)
require "#{APP_ROOT}/cli.rb"
require "#{APP_ROOT}/Cli.rb"
options = {}
OptionParser.new do |opts|