From 4a793c23d5b1c89150609c2a7a3343ae4f9f3bdb Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Wed, 15 Jan 2025 16:32:47 +0000 Subject: [PATCH] fix: Only display "Session Authenticated" label if auth is successful --- jupyter/uvdat_explorer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jupyter/uvdat_explorer.py b/jupyter/uvdat_explorer.py index 02a2fe8e..184f9021 100644 --- a/jupyter/uvdat_explorer.py +++ b/jupyter/uvdat_explorer.py @@ -149,8 +149,9 @@ def __init__(self, api_url=None, email=None, password=None): children.append(self.password_input) if email and password: - self.authenticate() - children.append(widgets.Label('Session Authenticated.')) + authenticated = self.authenticate() + if authenticated: + children.append(widgets.Label('Session Authenticated.')) children.append(self.button) # Display @@ -179,8 +180,10 @@ def authenticate(self): self.token = response.json().get('token') self.session.headers['Authorization'] = f'Token {self.token}' self.authenticated = True + return True else: print('Invalid login.') + return False def get_datasets(self, *args): with self.output: