Skip to content

Commit

Permalink
v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhorasani committed Sep 29, 2024
1 parent d853ab6 commit f74af56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="streamlit-authenticator",
version="0.3.4",
version="0.4.0",
author="Mohammad Khorasani",
author_email="[email protected]",
description="A secure authentication module to manage user access in a Streamlit application.",
Expand Down
12 changes: 6 additions & 6 deletions streamlit_authenticator/models/authentication_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def _get_user_variables(self, username: str) -> tuple:
def guest_login(self, cookie_controller: Any, provider: str='google',
oauth2: Optional[dict]=None, max_concurrent_users: Optional[int]=None,
single_session: bool=False, roles: Optional[List[str]]=None,
callback: Optional[Callable]=None) -> str:
callback: Optional[Callable]=None) -> Optional[str]:
"""
Executes the guest login by setting authentication status to true and adding the user's
username and name to the session state.
Expand All @@ -269,7 +269,7 @@ def guest_login(self, cookie_controller: Any, provider: str='google',
Returns
-------
str
Optional[str]
The authorization endpoint URL for the guest login.
"""
if not oauth2 and self.path:
Expand All @@ -289,14 +289,14 @@ def guest_login(self, cookie_controller: Any, provider: str='google',
self.credentials['usernames'][result['email']] = {}
self.credentials['usernames'][result['email']] = \
{'email': result['email'],
'logged_in': True, 'first_name': result['given_name'],
'last_name': result['family_name'],
'picture': result['picture'] if 'picture' in result else None,
'logged_in': True, 'first_name': result.get('given_name', ''),
'last_name': result.get('family_name', ''),
'picture': result.get('picture', None),
'roles': roles}
if single_session and self.credentials['usernames'][result['email']]['logged_in']:
raise LoginError('Cannot log in multiple sessions')
st.session_state['authentication_status'] = True
st.session_state['name'] = f'{result['given_name']} {result['family_name']}'
st.session_state['name'] = f'{result.get("given_name", "")} {result.get("family_name", "")}'
st.session_state['email'] = result['email']
st.session_state['username'] = result['email']
st.session_state['roles'] = roles
Expand Down

0 comments on commit f74af56

Please sign in to comment.