example/example.rb in lastpass-1.3.0 vs example/example.rb in lastpass-1.4.0
- old
+ new
@@ -5,31 +5,33 @@
# $ rake example
require "lastpass"
require "yaml"
+DEVICE_ID = "example.rb"
+
credentials = YAML.load_file File.join File.dirname(__FILE__), "credentials.yaml"
username = credentials["username"]
password = credentials["password"]
begin
# First try without a multifactor password
- vault = LastPass::Vault.open_remote username, password
+ vault = LastPass::Vault.open_remote username, password, nil, DEVICE_ID
rescue LastPass::LastPassIncorrectGoogleAuthenticatorCodeError => e
# Get the code
puts "Enter Google Authenticator code:"
multifactor_password = gets.chomp
# And now retry with the code
- vault = LastPass::Vault.open_remote username, password, multifactor_password
+ vault = LastPass::Vault.open_remote username, password, multifactor_password, DEVICE_ID
rescue LastPass::LastPassIncorrectYubikeyPasswordError => e
# Get the password
puts "Enter Yubikey password:"
multifactor_password = gets.chomp
# And now retry with the Yubikey password
- vault = LastPass::Vault.open_remote username, password, multifactor_password
+ vault = LastPass::Vault.open_remote username, password, multifactor_password, DEVICE_ID
end
vault.accounts.each_with_index do |i, index|
puts "#{index + 1}: #{i.id} #{i.name} #{i.username} #{i.password} #{i.url} #{i.group}"
end