{% extends base.html %}

{% block title %}[{{instance.hostname}}:{{instance.pg_port}}] - Login{% end %}

{% block content %}
{% if username is not None %}
<div class="row d-flex justify-content-center">
  <div class="col-xl-4 col-md-6">
    <div class="alert alert-info" role="alert">
      <h4><i class="fa fa-info fa-fw"></i>Information</h4>
      <p>You're logged in at <b>{{instance.agent_address}}:{{instance.agent_port}}</b> as <b>{{username}}</b>.</p>
    </div>
  </div>
</div>
{% else %}
<div class="row justify-content-center">
  <div class="col-xl-6 col">
    <div class="alert alert-warning" role="alert">
      <h4><i class="fa fa-warning fa-fw"></i>WARNING</h4>
      <p>To access this section you must be authenticated by the agent at <b>{{instance.agent_address}}:{{instance.agent_port}}</b></p>
    </div>
  </div>
</div>
<div class="row justify-content-center">
  <div class="col-xl-4 col-md-6">
    <div class="card" id="panelLogin">
      <div class="card-header">
        Please login
      </div>
      <div class="card-body">
      {% try %}{% if error %}<div class="alert alert-danger" role="alert">ERROR: {{ error }}</div>{% end %}{% except %}{% end %}
      <form role="form" action="login" method="post">
        <div class="form-group">
          <label for="inputUsername" class="control-label">Username</label>
          <input type="text" name="username" class="form-control" id="inputUsername" placeholder="Username" autofocus>
        </div>
        <div class="form-group">
          <label for="inputPassword" class="control-label">Password</label>
          <input type="password" name="password" class="form-control" id="inputPassword" placeholder="Password">
        </div>
        <div class="text-center">
          <button type="submit" class="btn btn-primary">Login</button>
        </div>
      </form>
    </div>
  </div>
</div>
{% end %}
{% end %}
