Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto login after registration #140

Open
federico-cau-linkalab opened this issue Feb 27, 2024 · 1 comment
Open

Auto login after registration #140

federico-cau-linkalab opened this issue Feb 27, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@federico-cau-linkalab
Copy link

federico-cau-linkalab commented Feb 27, 2024

Hi, great job with this component, it is really useful.

I was trying to do a login or register and I thought it would be useful to be able to have automatic login after a registration done with register_user(), maybe with a boolean parameter, e.g. login=True. This would avoid trying to find a way to do a page reset, and it would be more convenient for users who register not to have to log in right afterwards.

This is the code I am using

if not st.session_state['authentication_status']:
    tab1, tab2 = st.tabs(["Login", "Register"])
    with tab1:
        authenticator.login(location='main')
    with tab2:
        email_of_registered_user, username_of_registered_user, name_of_registered_user = authenticator.register_user(preauthorization=False)
        if email_of_registered_user:
            st.success('User registered successfully')
            with open('./config.yaml', 'w') as file:
                yaml.dump(config, file, default_flow_style=False)
@mkhorasani
Copy link
Owner

Excellent idea, I will look into it for a future release.

@mkhorasani mkhorasani added the enhancement New feature or request label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants