Comments (6)
Can you please provide a snippet of your code?
from streamlit-authenticator.
Can you please provide a snippet of your code?
Sure Thanks for the help:
I simply add function to reset pwd right after user successfully log in and test logging out.
import streamlit as st
import streamlit_authenticator as stauth
import yaml
from yaml import SafeLoader
with open('config.yaml') as file:
config = yaml.load(file, Loader=SafeLoader)
authenticator = stauth.authenticate.Authenticate(
config['credentials'],
config['cookie']['name'],
config['cookie']['key'],
config['cookie']['expiry_days'],
config['preauthorized']
)
name, authentication_status, username = authenticator.login('Login', 'main')
if st.session_state["authentication_status"]:
authenticator.logout('Logout', 'main')
st.title(f'Welcome *{st.session_state["name"]}*')
if authentication_status:
try:
if authenticator.update_user_details(username, 'Update user details'):
st.success('Entries updated successfully')
except Exception as e:
st.error(e)
elif st.session_state["authentication_status"] == False:
st.error('Username/password is incorrect')
elif st.session_state["authentication_status"] == None:
st.warning('Please enter your username and password')
from streamlit-authenticator.
Pleas refer to point 9 of the readme file, once you have updated the config file on memory, you must then commit it to disk.
from streamlit-authenticator.
Pleas refer to point 9 of the readme file, once you have updated the config file on memory, you must then commit it to disk.
Thank you very much. Apologize for not fully understand the library.
from streamlit-authenticator.
import streamlit as st import streamlit_authenticator as stauth import yaml from yaml import SafeLoader with open('config.yaml') as file: config = yaml.load(file, Loader=SafeLoader) authenticator = stauth.authenticate.Authenticate( config['credentials'], config['cookie']['name'], config['cookie']['key'], config['cookie']['expiry_days'], config['preauthorized'] ) name, authentication_status, username = authenticator.login('Login', 'main') if st.session_state["authentication_status"]: authenticator.logout('Logout', 'main') st.title(f'Welcome *{st.session_state["name"]}*') if authentication_status: try: if authenticator.update_user_details(username, 'Update user details'): st.success('Entries updated successfully') except Exception as e: st.error(e) elif st.session_state["authentication_status"] == False: st.error('Username/password is incorrect') elif st.session_state["authentication_status"] == None: st.warning('Please enter your username and password')
@jitvimol Where did you insert the code from the readme that updates config.yaml
within the above code snippet? I'm having trouble implementing this functionality in my streamlit app.
from streamlit-authenticator.
Here is the snippet that saves your changes:
with open('../config.yaml', 'w') as file:
yaml.dump(config, file, default_flow_style=False)
from streamlit-authenticator.
Related Issues (20)
- No module named 'streamlit_authenticator'
- how to keep login after page refresh? HOT 4
- ReadMe example does not work HOT 5
- I have an "invalid salt" print, without error (no reaction...) HOT 2
- Use of pyproject.toml and proper package manager HOT 1
- Infinit cookie does not work HOT 1
- Registration user widget does not work if activated on some button click HOT 1
- Add clear on submit option to authenticate.py reset_password() HOT 1
- How to use preauthorization? HOT 2
- Azure AAD Oauth2 Support
- The config.yaml file is not updated on GitHub when registering a new user HOT 2
- Invalidate streamlit-authenticator JWT upon logout HOT 2
- hope authentication_status not sync across multi pages
- widget after button then not work HOT 2
- Capturing username of failed login attempts HOT 1
- Login needs 2x click (authentication_status possible error) HOT 1
- Adding custom form field validation for "register_user" HOT 2
- When using st.chat_input to enter a message, the message sometimes disappears immediately after input.
- reset password does not work HOT 7
- Authentication is causing chat functionality to fail on the streamlit cloud HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from streamlit-authenticator.