How to customize flask.ext.security.forms.LoginForm to prompt and use username instead of email?
I have tried this,
class ExtendedLoginForm(LoginForm):
name = TextField('User Name:', [Required()])
del LoginForm.email
security = Security(app, user_datastore, login_form=ExtendedLoginForm)
Changed the template,
<form action="{{ url_for_security('login') }}" method="POST" name="login_user_form">
{{ login_user_form.hidden_tag() }}
**{{ render_field_with_errors(login_user_form.name) }}**
{{ render_field_with_errors(login_user_form.password) }}
{{ render_field_with_errors(login_user_form.remember) }}
{{ render_field(login_user_form.next) }}
{{ render_field(login_user_form.submit) }}
</form>
changed userdb to use name instead of email
But still flask-security tries to find email in datastore instead of user.
In earlier versions of flask-security, the unique identifier of the user was the email property. You could extend models by adding your own properties, but the email field still served to uniquely identify the user (so the username had to be the email field). From version 1.7.0 it is possible to identify user with a different property. In the config file you should add the
But you still have to have the email property in your model. There was a issue reported 3 days on git, for exactly what you are looking for https://github.com/mattupstate/flask-security/issues/396