Streamlit Version
1.45.1
Streamlit Authenticator Version
0.4.2
Environment
ubuntu, python3.12
What happened?
The pre_authorized feature works only once.
What did you expect to happen?
I expect to be able to register multiple times when using pre_authorised email list.
Steps to reproduce
Context:
- Pass a authenticator config as a path
- Use
pre-authorized email list for registration
When using a config to allow only certain emails to register, register_user function expects the following format for the config:
pre-authorised:
emails:
- foo@mail.com
- ...
Once a user registers successfully, register_user function remove the email from the list and updates the config file but changes its structure:
pre-authorised:
- foo@mail.com
Next registration attempts will crash.
The relevant piece of code :
if not pre_authorized and self.path:
# HERE we read from pre-authorized.emails
pre_authorized = self.config.get('pre-authorized', {}).get('emails', None)
if isinstance(pre_authorized, list):
if new_email in pre_authorized:
self._register_credentials(new_username, new_first_name, new_last_name,
new_password, new_email, password_hint, roles)
pre_authorized.remove(new_email)
if self.path:
# HERE we write back the email list to pre-authorized instead of authorized.emails
Helpers.update_config_file(self.path, 'pre-authorized', pre_authorized)
Streamlit Version
1.45.1
Streamlit Authenticator Version
0.4.2
Environment
ubuntu, python3.12
What happened?
The pre_authorized feature works only once.
What did you expect to happen?
I expect to be able to register multiple times when using pre_authorised email list.
Steps to reproduce
Context:
pre-authorizedemail list for registrationWhen using a config to allow only certain emails to register,
register_userfunction expects the following format for the config:Once a user registers successfully,
register_userfunction remove the email from the list and updates the config file but changes its structure:Next registration attempts will crash.
The relevant piece of code :