Nov-19-2020, 06:35 PM
Hi,
I am trying to display a custom error message when the user enters a wrong password in a login form on my django app.
Currently, when the user enters a wrong password, it displays an error message saying "Invalid login". Also, not sure why it has a bullet point in front of it as well.
This is code in my login.html:
I am trying to display a custom error message when the user enters a wrong password in a login form on my django app.
Currently, when the user enters a wrong password, it displays an error message saying "Invalid login". Also, not sure why it has a bullet point in front of it as well.
This is code in my login.html:
{% extends 'base.html' %}
{% block content %}
<form method="post">
{% csrf_token %}
{% for field in login_form %}
<p>
{{field.label_tag}}
{{field}}
{% if field.help_text %}
{field.help_text}}
{% endif %}
</p>
{% endfor %}
{% for field in login_form %}
{% for error in field.errors %}
<p>{{error}}</p>
{% endfor %}
{% endfor %}
{% if login_form.non_field_errors %}
<p>{{login_form.non_field_errors}}</p>
{% endif %}
<button type="submit">login</button>
</form>
{% endblock content %}Thanks
