mkhorasani / Streamlit-Authenticator

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

validate_name function validation issues #151

Closed wyzdic closed 2 months ago

wyzdic commented 2 months ago

def validate_name(self, name: str) -> bool: """ Checks the validity of the entered name.

    Parameters
    ----------
    name: str
        The name to be validated.

    Returns
    -------
    bool
        Validity of entered name.
    """
    pattern = r"^[A-Za-z ]+$"
    return 1 <= len(name) <= 100 and bool(re.match(pattern, name))

This function prevents the user name from being set to Chinese characters

mkhorasani commented 2 months ago

@wyzdic thank you for bringing this to my attention, I have already made the appropriate changes and will push it in the next release. In the meantime, I recommend you pass your own customized validator object to the authenticate class, for further information please refer to this file.