Comments (12)
I had the same issue when using the function authenticator.reset_password()
on a second page of my app as I want my users to have a dedicated page to account management. Calling the authenticator.login()
before the authenticator.reset_password()
in the code of the second page fixed it for now. I am using streamlit v1.31.1 and streamlit-authenticator v0.3.1. Thank you for the streamlit-authenticator library.
from streamlit-authenticator.
@ebynapura can you please elaborate by providing a snippet of your code and specify the version of Streamlit-Authenticator you are using?
from streamlit-authenticator.
@ebynapura can you please elaborate by providing a snippet of your code and specify the version of Streamlit-Authenticator you are using?
import streamlit as st
import streamlit_authenticator as stauth
# from streamlit_authenticator import Authenticate
import yaml
from yaml.loader import SafeLoader
st.set_page_config(
page_title="Acg-DataBoard",
page_icon="data1.svg",
layout="wide",
initial_sidebar_state="collapsed", # expanded auto
)
# Import the YAML file into your script
with open('config.yaml') as file:
config = yaml.load(file, Loader=SafeLoader)
hashed_passwords = stauth.Hasher(['000000', '000000']).generate()
# print(hashed_passwords)
# Create the authenticator object
authenticator = stauth.Authenticate(
config['credentials'],
config['cookie']['name'],
config['cookie']['key'],
config['cookie']['expiry_days'],
config['preauthorized']
)
if st.session_state["authentication_status"]:
authenticator.logout(button_name='退出账户', location='sidebar')
try:
if authenticator.reset_password(st.session_state["username"], location='sidebar',
fields={'Form name':'重设密码', 'Current password':'当前密码',
'New password':'新密码', 'Repeat password': '确认新密码', 'Reset':'重设'}):
with open('config.yaml', 'w') as file:
yaml.dump(config, file, default_flow_style=False)
st.success("已成功修改密码~")
except Exception as e:
st.error(e)
try:
if authenticator.update_user_details(st.session_state["username"], location='sidebar',
fields={'Form name':'更新用户信息', 'Field':'更新项', 'Name':'姓名',
'Email':'邮箱', 'New value':'更新为', 'Update':'更新'}):
with open('config.yaml', 'w') as file:
yaml.dump(config, file, default_flow_style=False)
st.success('已成功修改信息~')
except Exception as e:
st.error(e)
st.write(f'欢迎: *{st.session_state["name"]}*')
st.title('Some content')
elif st.session_state["authentication_status"] is False:
st.error('用户名或密码不正确~')
elif st.session_state["authentication_status"] is None:
st.warning('请输入您的用户名和密码~')
authenticator.login(fields={'Form name': '登录'})
from streamlit-authenticator.
@ebynapura can you please elaborate by providing a snippet of your code and specify the version of Streamlit-Authenticator you are using?
import streamlit as st import streamlit_authenticator as stauth # from streamlit_authenticator import Authenticate import yaml from yaml.loader import SafeLoader st.set_page_config( page_title="Acg-DataBoard", page_icon="data1.svg", layout="wide", initial_sidebar_state="collapsed", # expanded auto ) # Import the YAML file into your script with open('config.yaml') as file: config = yaml.load(file, Loader=SafeLoader) hashed_passwords = stauth.Hasher(['000000', '000000']).generate() # print(hashed_passwords) # Create the authenticator object authenticator = stauth.Authenticate( config['credentials'], config['cookie']['name'], config['cookie']['key'], config['cookie']['expiry_days'], config['preauthorized'] ) if st.session_state["authentication_status"]: authenticator.logout(button_name='退出账户', location='sidebar') try: if authenticator.reset_password(st.session_state["username"], location='sidebar', fields={'Form name':'重设密码', 'Current password':'当前密码', 'New password':'新密码', 'Repeat password': '确认新密码', 'Reset':'重设'}): with open('config.yaml', 'w') as file: yaml.dump(config, file, default_flow_style=False) st.success("已成功修改密码~") except Exception as e: st.error(e) try: if authenticator.update_user_details(st.session_state["username"], location='sidebar', fields={'Form name':'更新用户信息', 'Field':'更新项', 'Name':'姓名', 'Email':'邮箱', 'New value':'更新为', 'Update':'更新'}): with open('config.yaml', 'w') as file: yaml.dump(config, file, default_flow_style=False) st.success('已成功修改信息~') except Exception as e: st.error(e) st.write(f'欢迎: *{st.session_state["name"]}*') st.title('Some content') elif st.session_state["authentication_status"] is False: st.error('用户名或密码不正确~') elif st.session_state["authentication_status"] is None: st.warning('请输入您的用户名和密码~') authenticator.login(fields={'Form name': '登录'})
Which version of Streamlit_authenticator are you using?
from streamlit-authenticator.
@ebynapura can you please elaborate by providing a snippet of your code and specify the version of Streamlit-Authenticator you are using?
Which version of Streamlit_authenticator are you using?
it's 0.3.1
from streamlit-authenticator.
Dear @ebynapura you have raised an interesting issue, while I would not consider this to be a bug per se, it is indeed an issue that I need to address. The problem is that if you do not invoke the login widget, the max_concurrent_users attribute will not defined, leading to errors for other methods in the class. For your case if you can try to use the login widget before you use the reset password widget. And in the meantime, I will try to push a new release to address this issue.
from streamlit-authenticator.
Dear @ebynapura you have raised an interesting issue, while I would not consider this to be a
ok thx~
from streamlit-authenticator.
Dear @ebynapura you have raised an interesting issue, while I would not consider this to be a bug per se, it is indeed an issue that I need to address. The problem is that if you do not invoke the login widget, the max_concurrent_users attribute will not defined, leading to errors for other methods in the class. For your case if you can try to use the login widget before you use the reset password widget. And in the meantime, I will try to push a new release to address this issue.
This is a issue, I can't implement the ability to reset my password right now, even after reusing the login component
from streamlit-authenticator.
Dear @ebynapura you have raised an interesting issue, while I would not consider this to be a bug per se, it is indeed an issue that I need to address. The problem is that if you do not invoke the login widget, the max_concurrent_users attribute will not defined, leading to errors for other methods in the class. For your case if you can try to use the login widget before you use the reset password widget. And in the meantime, I will try to push a new release to address this issue.
When will this be fixed?
from streamlit-authenticator.
Apologies for the delay, will try to release a new version this weekend.
from streamlit-authenticator.
Apologies for the delay, will try to release a new version this weekend.
Oh, fantastic, looking forward to this fix! I am also getting the same error and the suggestions above did not resolve it... Thank you for this library!
from streamlit-authenticator.
Dear all this issue has now been fixed in v0.3.2. Thank you for your patience.
from streamlit-authenticator.
Related Issues (20)
- To force user to use stonger password when they register HOT 2
- Captcha verification HOT 1
- streamlit_authenticator import error HOT 2
- Cannot instantiate authenticator object in multiple pages: DuplicatedWidgetId HOT 1
- Suggested improvement: Remove spaces in input text in login form to prevent failed login during autocomplete
- logged_in field in credentials is not used to force authentication HOT 2
- Refresh Page Would Lost Login and the way to fix it HOT 1
- Typo in README.md in Authenticate.register_user(): pre-authorization => pre_authorization HOT 1
- Add callback options for widgets
- DeprecationError: Likely deprecation error, the 'form_name' parameter has been replaced with the 'fields' parameter. HOT 1
- add firebase capability HOT 3
- authenticator.login() is takes too much time HOT 4
- Forgot password and forgot username components HOT 1
- Logout takes a lot of time when there is more data in the application's session state. HOT 1
- Streamlit-authenticator conflict with streamlit_modal popups HOT 2
- Error when user login is cached in browser HOT 9
- README.md HOT 1
- Trying to delete a cookie that does not exist in the self.cookies dictionary HOT 1
- No middle name or initials are allowed by authenticator.register_user() HOT 5
- How do I execute logout button logic? HOT 1
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.