flask-security icon indicating copy to clipboard operation
flask-security copied to clipboard

Allow override of Username

Open coolacid opened this issue 1 year ago • 0 comments

Currently, one can overload Username text on the register form by doing the following:

from flask_security.forms import _default_field_labels
from flask_security.utils import _

_default_field_labels["username"] = _("Callsign")

The text is calculated at run time because get_register_username_field is a callable.

However, since the login form uses login_username_field, which is a variable not a callable, the text is calculated at import, not at run time.

This PR changes the login_username_field variable, to a callable, allowing the Username text value to be changed using the same method as the register form.

coolacid avatar Jan 01 '24 17:01 coolacid