mkhorasani / Streamlit-Authenticator

A secure authentication module to validate user credentials in a Streamlit application.
Apache License 2.0
1.37k stars 229 forks source link

Missing "submit button" error and TypeError: string indices must be integers (using streamlit) #127

Closed MaxSeck closed 5 months ago

MaxSeck commented 5 months ago

Error: Missing Submit Button This form has no submit button, which means that user interactions will never be sent to your Streamlit app. To create a submit button, use the st.form_submit_button() function."

TypeError: string indices must be integers: name, loginstate, username = authenticator.login(fields ='Login') --> implemented (fields='Login') if login_form.form_submit_button('Login' if 'Login' not in fields else fields['Login']):

I think the issues came with the update to 0.3.1. Somebody with the same problems here?

mkhorasani commented 5 months ago

Dear @MaxSeck the fields parameter is dictionary and not a str. Please follow the documentation found here. You will need to provide the fields parameter as follows:

authenticator.login(fields={'Form name':'Login', 'Username':'Username', 'Password':'Password', 'Login':'Login'})
MaxSeck commented 5 months ago

Thank you a lot @mkhorasani. That fixed my problem!