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

Improve error message for registration #118

Closed fsmosca closed 5 months ago

fsmosca commented 5 months ago

I set domain to yahoo.com and tried to register using gmail. Got the error message below.

def get_register(authenticator):
    try:
        if authenticator.register_user(
            location='main',
            preauthorization=False,
            domains=['yahoo.com'],
            fields={'Form name': 'Register user'}
        ):
            save_config_to_deta(config)
            st.success('Registration is successful!')
    except Exception as e:
        st.error(e)

image

To improve the error message, perhaps you need to mention that only the domains found in domains are supported. In this case, only yahoo. The reason is to inform the users of the real reason why their emails are not accepted.

It can be:

Only emails from {domains} are supported.

Setup

mkhorasani commented 5 months ago

@fsmosca you can also display your own customized error message within the except block if you like.