-
Notifications
You must be signed in to change notification settings - Fork 292
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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-authorizedemail 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:
- [email protected]
- ...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:
- [email protected]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)Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working