mkhorasani/Streamlit-Authenticator

Suggested improvement: Remove spaces in input text in login form to prevent failed login during autocomplete

agomezh opened this issue · 1 comments

My browser autocompletes certain logins. It did with streamlit authenticator, but it (for some reason), added a space at the end. Therefore instead of 'my_username' it was 'my_username '. This prompted the authenticator to fail.

My suggestion is to add .strip() in the result of the username when logging in.

Line 197 of https://github.com/mkhorasani/Streamlit-Authenticator/blob/main/streamlit_authenticator/authenticate/__init__.py

From:

username = login_form.text_input('Username' if 'Username' not in fields else fields['Username']).lower()

To:

username = login_form.text_input('Username' if 'Username' not in fields else fields['Username']).lower().strip()

I would create a pull request, but I simply don't feel comfortable yet proposing such changes, so better to raise it here and discuss it if necessary.

Thank you for the component :).

Done! Please refer to v0.3.3.