Skip to content

Commit f74af56

Browse files
committed
v0.4.0
1 parent d853ab6 commit f74af56

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="streamlit-authenticator",
8-
version="0.3.4",
8+
version="0.4.0",
99
author="Mohammad Khorasani",
1010
author_email="khorasani.mohammad@gmail.com",
1111
description="A secure authentication module to manage user access in a Streamlit application.",

streamlit_authenticator/models/authentication_model.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def _get_user_variables(self, username: str) -> tuple:
243243
def guest_login(self, cookie_controller: Any, provider: str='google',
244244
oauth2: Optional[dict]=None, max_concurrent_users: Optional[int]=None,
245245
single_session: bool=False, roles: Optional[List[str]]=None,
246-
callback: Optional[Callable]=None) -> str:
246+
callback: Optional[Callable]=None) -> Optional[str]:
247247
"""
248248
Executes the guest login by setting authentication status to true and adding the user's
249249
username and name to the session state.
@@ -269,7 +269,7 @@ def guest_login(self, cookie_controller: Any, provider: str='google',
269269
270270
Returns
271271
-------
272-
str
272+
Optional[str]
273273
The authorization endpoint URL for the guest login.
274274
"""
275275
if not oauth2 and self.path:
@@ -289,14 +289,14 @@ def guest_login(self, cookie_controller: Any, provider: str='google',
289289
self.credentials['usernames'][result['email']] = {}
290290
self.credentials['usernames'][result['email']] = \
291291
{'email': result['email'],
292-
'logged_in': True, 'first_name': result['given_name'],
293-
'last_name': result['family_name'],
294-
'picture': result['picture'] if 'picture' in result else None,
292+
'logged_in': True, 'first_name': result.get('given_name', ''),
293+
'last_name': result.get('family_name', ''),
294+
'picture': result.get('picture', None),
295295
'roles': roles}
296296
if single_session and self.credentials['usernames'][result['email']]['logged_in']:
297297
raise LoginError('Cannot log in multiple sessions')
298298
st.session_state['authentication_status'] = True
299-
st.session_state['name'] = f'{result['given_name']} {result['family_name']}'
299+
st.session_state['name'] = f'{result.get("given_name", "")} {result.get("family_name", "")}'
300300
st.session_state['email'] = result['email']
301301
st.session_state['username'] = result['email']
302302
st.session_state['roles'] = roles

0 commit comments

Comments
 (0)