Clear credentials on failed login
authorJakob <jakob@jcornell.net>
Tue, 3 Dec 2019 05:17:06 +0000 (23:17 -0600)
committerJakob <jakob@jcornell.net>
Tue, 3 Dec 2019 05:17:06 +0000 (23:17 -0600)
auth.py
common.py

diff --git a/auth.py b/auth.py
index e20a81ae4b2b8bb1f570e293085de5020b80359d..74ebd312b7a833c1fc1f9ac2f48d03e4aa6ef842 100644 (file)
--- 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)
index b6346a6b8cc3a68ab184561b0a5af0f1bf0c5d48..e3830c2cd34cbdf40bbf4850b895697d0b5bfeec 100644 (file)
--- 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)