Skip to content

Commit

Permalink
fix: Only display "Session Authenticated" label if auth is successful
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Jan 15, 2025
1 parent 4855d36 commit 4a793c2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions jupyter/uvdat_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4a793c2

Please sign in to comment.