diff options
Diffstat (limited to 'Tools/Scripts/webkitpy/common/net/credentials.py')
-rw-r--r-- | Tools/Scripts/webkitpy/common/net/credentials.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Tools/Scripts/webkitpy/common/net/credentials.py b/Tools/Scripts/webkitpy/common/net/credentials.py index d76405b39..21aeaeafe 100644 --- a/Tools/Scripts/webkitpy/common/net/credentials.py +++ b/Tools/Scripts/webkitpy/common/net/credentials.py @@ -131,9 +131,12 @@ class Credentials(object): return if not User().confirm("Store password in system keyring?", User.DEFAULT_NO): return - self._keyring.set_password(self.host, username, password) + try: + self._keyring.set_password(self.host, username, password) + except: + pass - def read_credentials(self): + def read_credentials(self, user=User): username, password = self._credentials_from_environment() # FIXME: We don't currently support pulling the username from one # source and the password from a separate source. @@ -142,13 +145,17 @@ class Credentials(object): if not username or not password: username, password = self._credentials_from_keychain(username) + if not username: + username = user.prompt("%s login: " % self.host) + if username and not password and self._keyring: - password = self._keyring.get_password(self.host, username) + try: + password = self._keyring.get_password(self.host, username) + except: + pass - if not username: - username = User.prompt("%s login: " % self.host) if not password: - password = User.prompt_password("%s password for %s: " % (self.host, username)) + password = user.prompt_password("%s password for %s: " % (self.host, username)) self._offer_to_store_credentials_in_keyring(username, password) return (username, password) |