Flask-Security requires a lot of authentication and authorization efforts to develop Python Flask web applications. However, I ran into one problem.
Messages appear on the login page in response to various invalid logins. Examples include: - The specified user does not exist - The password is incorrect - The account is disabled.
This does not comply with safety guidelines. You should not inform the user of information about why his or her login attempt was rejected. The above messages make it easy for a hacker to identify valid usernames.
I would like to override these standard Flask-Security messages, replacing them with something like "Invalid username or password." However, I did not find a convenient way to do this.
These messages are stored in _default_messages at site-packages / flask_security / core.py. I could modify this file, but this is not a good solution: it will break if I reinstall or update Flask-Security.
I know that configures the default flags for security flasks . But opinions contain useful code like
{{ render_field_with_errors(login_user_form.email) }}
which hides implementation details of the login form. I would not want to give up all this useful code and rewrite most of it to change a few posts.
Does anyone know how best to configure messages for logging into Flask-Security?