How to display error message when new password does not match with repeat password using streamlit authenticator widget?
Steps to reproduce
if authenticator.reset_password(username, 'Reset password'):
st.success('Password modified successfully')
The above code resets the password if we enter new password and repeat password as same, but the widget just dissapears without displaying any error if the two passwords do not match. How can I fix this?
I expect the program to show an error message as- “New password and Repeat password does not match, please try again”
The widget entirely dissapears without letting the users know that the password could not be reset. This does not reset the password.
Check out this blog for code on authenticator widget.
Can someone help me fix the issue?
I’m not an expert on that component, but it looks like this logic is implemented in line 277 of this file.
if len(new_password) > 0:
if new_password == new_password_repeat:
if self.password != new_password:
raise ResetError('New and current passwords are the same')
raise ResetError('Passwords do not match')
raise ResetError('No new password provided')
Hello Caroline, I’ve another question about password resets.
This is my code for the widget:
Where will the new password be sent to? Is it via email? Cos i can’t seem to find it! thank you so much!
username_of_forgotten_password, email_of_forgotten_password, new_random_password = authenticator.forgot_password('Reset password here')
st.success('New password sent securely')
Oh I figured it out! It returns the parameter of new_random_password and its up to me on how I want to securely transfer it to the user or just have it simply written in the next line.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.