diff --git a/setup.py b/setup.py index e0aa00e..b66fa6e 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="streamlit-authenticator", - version="0.4.2", + version="0.4.2-alpha", author="Mohammad Khorasani", author_email="khorasani.mohammad@gmail.com", description="A secure authentication module to manage user access in a Streamlit application.", diff --git a/streamlit_authenticator/models/authentication_model.py b/streamlit_authenticator/models/authentication_model.py index c7ec620..1631e8b 100644 --- a/streamlit_authenticator/models/authentication_model.py +++ b/streamlit_authenticator/models/authentication_model.py @@ -14,21 +14,22 @@ import streamlit as st -from ..models.cloud import CloudModel -from ..models.oauth2 import GoogleModel -from ..models.oauth2 import MicrosoftModel from .. import params -from ..utilities import (Encryptor, - Hasher, - Helpers, - CloudError, - CredentialsError, - ForgotError, - LoginError, - RegisterError, - ResetError, - UpdateError, - Validator) +from ..models.cloud import CloudModel +from ..models.oauth2 import GoogleModel, MicrosoftModel +from ..utilities import ( + CloudError, + CredentialsError, + Encryptor, + ForgotError, + Hasher, + Helpers, + LoginError, + RegisterError, + ResetError, + UpdateError, + Validator, +) class AuthenticationModel: @@ -568,7 +569,7 @@ def register_user(self, new_first_name: str, new_last_name: str, new_email: str, new_password, new_email, password_hint, roles) pre_authorized.remove(new_email) if self.path: - Helpers.update_config_file(self.path, 'pre-authorized', pre_authorized) + Helpers.update_config_file(self.path, 'pre-authorized', {"emails": pre_authorized}) if callback: callback({'widget': 'Register user', 'new_name': new_first_name, 'new_last_name': new_last_name, 'new_email': new_email, diff --git a/streamlit_authenticator/models/cookie_model.py b/streamlit_authenticator/models/cookie_model.py index 56e1c8b..17d5236 100644 --- a/streamlit_authenticator/models/cookie_model.py +++ b/streamlit_authenticator/models/cookie_model.py @@ -48,9 +48,9 @@ def __init__( """ if path: config = Helpers.read_config_file(path) - self.cookie_name = config['cookie']['name'] - self.cookie_key = config['cookie']['key'] - self.cookie_expiry_days = config['cookie']['expiry_days'] + self.cookie_name = cookie_name or config['cookie']['name'] + self.cookie_key = cookie_key or config['cookie']['key'] + self.cookie_expiry_days = cookie_expiry_days if cookie_expiry_days is not None else config['cookie']['expiry_days'] else: self.cookie_name = cookie_name self.cookie_key = cookie_key