Class: AddAction
- Inherits:
-
BaseAction
- Object
- BaseAction
- AddAction
- Defined in:
- lib/lockr/action/add.rb
Instance Method Summary collapse
-
#initialize(id, url, username, pwd, keyfile, vault) ⇒ AddAction
constructor
A new instance of AddAction.
Constructor Details
#initialize(id, url, username, pwd, keyfile, vault) ⇒ AddAction
Returns a new instance of AddAction.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lockr/action/add.rb', line 5 def initialize(id,url,username,pwd,keyfile,vault) super( keyfile, vault) pwd_directory = @pwdmgr.list() if pwd_directory.has_key?( id) pwd_directory_id = pwd_directory[id] else pwd_directory_id = {} end if ( pwd_directory_id.has_key?( username)) overwrite = ask( "Password already exists. Update? (y/n) ") { |q| } unless overwrite.downcase == 'y' exit 14 end end @pwdmgr.add( id, username, pwd, url) say("Password saved for ID '<%= color('#{id}', :blue) %>' and user '<%= color('#{username}', :green) %>'") end |