<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>{{ page_title }}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="{{ url_for('static', filename='plugins/fontawesome-free/css/all.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/ionicons.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/adminlte.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/fonts.css') }}">
    <link rel="shortcut icon" type="image/png" href="{{ url_for('static', filename='img/'+site_logo) }}"/>
</head>
<body class="hold-transition login-page">
  <div class="login-box">
    <div class="login-logo">
      <a href="#"><img src="/static/img/{{ site_logo }}"><b>{{ site_name }}</b></a>
    </div>
    <div class="card">
      <div class="card-body login-card-body">
        {% with messages = get_flashed_messages(category_filter=["error"]) %}
        {% if messages %}
        <div class="alert alert-danger alert-dismissible">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
            <h5><i class="icon fas fa-ban"></i> Authentication Error!</h5>
            <ul>
                {% for msg in messages %}
                <li>{{ msg }}</li>
                {% endfor %}
            </ul>
        </div>
        {% endif %}
        {% endwith %}
        {% with messages = get_flashed_messages(category_filter=["success"]) %}
        {% if messages %}
        <div class="alert alert-info alert-dismissible">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
            <h5><i class="icon fas fa-check"></i> Success!</h5>
            <ul>
                {% for msg in messages %}
                <li>{{ msg }}</li>
                {% endfor %}
            </ul>
        </div>
        {% endif %}
        {% endwith %}
        <p class="login-box-msg">Sign in to start your session</p>
        <form action="{{ url_for('login') }}" method="post">
          <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
          <div class="input-group mb-3">
            <input type="username" name="username" class="form-control" placeholder="Username">
            <div class="input-group-append input-group-text">
                <span class="fas fa-envelope"></span>
            </div>
          </div>
          <div class="input-group mb-3">
            <input type="password" name="password" class="form-control" placeholder="Password">
            <div class="input-group-append input-group-text">
                <span class="fas fa-lock"></span>
            </div>
          </div>
          <div class="row">
            <div class="col-12">
              <button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>

  <script src="{{ url_for('static', filename='plugins/jquery/jquery.min.js') }}"></script>
  <script src="{{ url_for('static', filename='plugins/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
  <script type=text/javascript>
    $(function() {
      $('.btn-primary').bind('click', function() {
        $($(this).attr('frmtarget')).submit();
      });
    });
  </script>
</body>
</html>
