From: Jakob Date: Tue, 3 Dec 2019 05:17:06 +0000 (-0600) Subject: Clear credentials on failed login X-Git-Url: https://jcornell.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=95bfbfc04bb4a6bfe9349236189f99e44ae71e5d;p=bb-sync-api.git Clear credentials on failed login --- diff --git a/auth.py b/auth.py index e20a81a..74ebd31 100644 --- a/auth.py +++ b/auth.py @@ -310,6 +310,8 @@ class CookieAuthHandler(urllib.request.HTTPCookieProcessor): if resp.url.endswith('/webapps/login'): log('error', "Login failed. Are your credentials correct?") + del self.storage_mgr['username'] + del self.stoarge_mgr['password'] else: self.storage_mgr['username'] = username self.storage_mgr['password'] = encode(password) diff --git a/common.py b/common.py index b6346a6..e3830c2 100644 --- a/common.py +++ b/common.py @@ -78,3 +78,7 @@ class StorageManager(): def __setitem__(self, key, value): self.patch[key] = value + + def __delitem__(self, key): + self.patch.pop(key, None) + self.cache.pop(key, None)