From a49506c79aac93648c76986c74946fbff893313f Mon Sep 17 00:00:00 2001 From: Jakob Date: Mon, 2 Dec 2019 23:08:49 -0600 Subject: [PATCH] Handle bad login credentials --- auth.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/auth.py b/auth.py index 269991d..e20a81a 100644 --- a/auth.py +++ b/auth.py @@ -283,8 +283,6 @@ class CookieAuthHandler(urllib.request.HTTPCookieProcessor): else: username = self.ui.ask_username() password = self.ui.ask_password() - self.storage_mgr['username'] = username - self.storage_mgr['password'] = encode(password) url = 'https://' + self.bb_root.host + str(self.bb_root.path) with self.parent.open(url) as resp: @@ -310,6 +308,12 @@ class CookieAuthHandler(urllib.request.HTTPCookieProcessor): with self.parent.open(req) as resp: resp.read() + if resp.url.endswith('/webapps/login'): + log('error', "Login failed. Are your credentials correct?") + else: + self.storage_mgr['username'] = username + self.storage_mgr['password'] = encode(password) + self.cookiejar.save() def http_error_401(self, request, fp, code, msg, headers): -- 2.30.2