Class: CredentialsManager::AccountManager
- Inherits:
-
Object
- Object
- CredentialsManager::AccountManager
- Defined in:
- lib/credentials_manager/account_manager.rb
Instance Method Summary collapse
-
#initialize(user: nil, password: nil) ⇒ AccountManager
constructor
A new instance of AccountManager.
-
#invalid_credentials(force: false) ⇒ Object
Call this method to ask the user to re-enter the credentials @return: Did the user decide to remove the old entry and enter a new password?.
- #password ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(user: nil, password: nil) ⇒ AccountManager
Returns a new instance of AccountManager.
6 7 8 9 |
# File 'lib/credentials_manager/account_manager.rb', line 6 def initialize(user: nil, password: nil) @user = user @password = password end |
Instance Method Details
#invalid_credentials(force: false) ⇒ Object
Call this method to ask the user to re-enter the credentials @return: Did the user decide to remove the old entry and enter a new password?
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/credentials_manager/account_manager.rb', line 33 def invalid_credentials(force: false) puts "The login credentials for '#{user}' seem to be wrong".red if force || agree("Do you want to re-enter your password? (y/n)", true) puts "Removing Keychain entry for user '#{user}'...".yellow remove_from_keychain ask_for_login return true end false end |
#password ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/credentials_manager/account_manager.rb', line 19 def password @password ||= ENV["FASTLANE_PASSWORD"] @password ||= ENV["DELIVER_PASSWORD"] unless @password item = Security::InternetPassword.find(server: server_name) @password ||= item.password if item end ask_for_login while @password.to_s.length == 0 return @password end |
#user ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/credentials_manager/account_manager.rb', line 11 def user @user ||= ENV["FASTLANE_USER"] @user ||= ENV["DELIVER_USER"] @user ||= AppfileConfig.try_fetch_value(:apple_id) ask_for_login if @user.to_s.length == 0 return @user end |