With the introduction of SECURITY_USER_IDENTITY_ATTRIBUTES we can easily add identity attributes (which has not yet been documented).
I can set this in my config:
SECURITY_USER_IDENTITY_ATTRIBUTES = ['email', 'username']
With custom form:
from flask_security.forms import RegisterForm, unique_user_email
# an alias to reflect a more accurate usage of the validator
unique_user_attribute = unique_user_email
class ExtendedRegisterForm(RegisterForm):
username = StringField('Username', [validators.Required(), unique_user_attribute])
tl;drunique_user_email validator is not quite accurate name with the introduction of SECURITY_USER_IDENTITY_ATTRIBUTES
With the introduction of SECURITY_USER_IDENTITY_ATTRIBUTES we can easily add identity attributes (which has not yet been documented).
I can set this in my config:
SECURITY_USER_IDENTITY_ATTRIBUTES = ['email', 'username']
With custom form:
tl;dr
unique_user_email
validator is not quite accurate name with the introduction ofSECURITY_USER_IDENTITY_ATTRIBUTES