{% macro render_field_with_errors(field, type) %}
<div class="form-group mb-3 {% if field.errors %} has-error{% endif %}">
    <input class="form-control" placeholder="{{ field.label.text }}" name="{{ field.name }}"
           type="{% if type %}{{ type }}{% else %}{{ field.type }}{% endif %}" autofocus>
    {% if field.errors %}
    {% for error in field.errors %}
    <span class="form-text">{{ error }}</span>
    {% endfor %}
    {% endif %}
</div>
{% endmacro %}
{% macro render_username_with_errors(field, type) %}
<div class="form-group mb-3 {% if field.errors %} has-error{% endif %}">
    <input class="form-control" placeholder="{{ field.label.text }} / Username" name="{{ field.name }}"
           type="{% if type %}{{ type }}{% else %}{{ field.type }}{% endif %}" autofocus>
    {% if field.errors %}
    {% for error in field.errors %}
    <span class="form-text">{{ error }}</span>
    {% endfor %}
    {% endif %}
</div>
{% endmacro %}
