{% extends "base-no-navbar.html" %}
{% block inside_head %}
  <link rel="stylesheet" href="{{ url_for('static', filename='login.css') }}" >
{% endblock %}
{% block content %}
  <form class="form-signin" action="{{ url_for('login') }}" method="post">
    {{ form.csrf_token }}

    <h2 class="form-signin-heading">{{ produto.nome }} Login</h2>

    {% if form.errors %}
      <div class="panel panel-danger">
        <div class="panel-heading">
          <h3 class="panel-title">Login falhou</h3>
        </div>
        <div class="panel-body">
          Nome de usuário ou senha inválidos.
          <!--
          {% for field in form %}
            {% for error in field.errors %}
              - {{ field.id }}: {{ error }}
            {% endfor %}
          {% endfor %}
          -->
        </div>
      </div>
    {% endif %}

    <label for="{{ form.username.id }}" class="sr-only">Nome de usuário</label>
    <input type="text" id="{{ form.username.id }}" name="{{ form.username.id }}"
        value="{% if form.username.data %}{{ form.username.data }}{% endif %}"
        class="form-control" placeholder="Nome de usuário" required autofocus>

    <label for="{{ form.password.id }}" class="sr-only">Senha</label>
    <input type="password" id="{{ form.password.id }}" name="{{ form.password.id }}"
        class="form-control" placeholder="Senha" required>

    <button class="btn btn-lg btn-primary btn-block" type="submit">Login</button>
  </form>
{% endblock %}
