20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/establish/password_manager.rb', line 20
def ask_for_login
puts "No username or password given. You can use environment variables"
puts "ESTABLISH_USER, ESTABLISH_PASSWORD"
puts "The login information will be stored in your keychain"
while (self.username || '').length == 0
self.username = ask("Username: ")
end
while (self.password || '').length == 0
self.password = ask("Password: ") { |q| q.echo = "*" }
end
if Security::InternetPassword.add(Establish::PasswordManager::HOST, self.username, self.password)
return true
else
Helper.log.error "Could not store password in keychain"
return false
end
end
|