I am using “streamlit_authenticator” package to display login screen for my app. It’s a nice piece of work. Thank you Mohammad Khorasani!
I need a little control over my “logout” button. I want to ask the user “Are you sure you want to logout?” / “Are you sure to abandon your work?” etc.
How do I do this?
LATER
Ferdy gave a nice workaround. But as advised by Ferdy, I did raise an issue with the streamlit-authenticator package. You can find it here. Thank you @ferdy.
The solution given in that thread by the author of the package is the best solution for this.
The “logout” function takes “unrendered” as one of the values for the “location” parameter. When passed like that, it will perform the logout operation without rendering the button. So this allows us to render a button, ask for confirmation etc. and then call the actual logout() function with location parameter set to “unrendered” to perform the actual logout. That’s a neat design. Thanks to author of Streamlit-authenticator (Mr. Mohammad Khorasani)