mkhorasani / Streamlit-Authenticator

A secure authentication module to validate user credentials in a Streamlit application.
Apache License 2.0
1.38k stars 229 forks source link

Fix the sample code in user registration. #119

Closed fsmosca closed 5 months ago

fsmosca commented 5 months ago

Old

try:
    if authenticator.register_user(preauthorization=False):
        st.success('User registered successfully')
except Exception as e:
    st.error(e)

Update

try:
    email, username, name = authenticator.register_user(
        location='main',
        preauthorization=False,
        domains=None,  # ['gmail.com', 'yahoo.com']
        fields={'Form name': 'Register User'}
    )
    if None not in (email, username, name):
        st.success('User registered successfully')
except Exception as e:
    st.error(e)

Also fix the return value of register_user() in the authenticate module.

mkhorasani commented 5 months ago

@fsmosca I'm not sure I understand what the issue is over here?

fsmosca commented 5 months ago

In the readme of this repo we have this currently. The code snippet is not entirely correct as that function returns a tuple.

image

In the source code, it is still bool which is incorrect.

image

mkhorasani commented 5 months ago

Thanks for pointing this out.