<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ZFBOX</title>
    <link rel="stylesheet" href="{{ url_for('main.static', filename='css/bootstrap.min.css') }}">
    <!-- <link href="../static/resources/css/bootstrap.min.css" rel="stylesheet"> -->

    <style>
      .bd-placeholder-img {
        font-size: 1.125rem;
        text-anchor: middle;
        -webkit-user-select: none;
        -moz-user-select: none;
        user-select: none;
      }

      @media (min-width: 768px) {
        .bd-placeholder-img-lg {
          font-size: 3.5rem;
        }
      }

      .b-example-divider {
        height: 3rem;
        background-color: rgba(0, 0, 0, .1);
        border: solid rgba(0, 0, 0, .15);
        border-width: 1px 0;
        box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
      }

      .b-example-vr {
        flex-shrink: 0;
        width: 1.5rem;
        height: 100vh;
      }

      .bi {
        vertical-align: -.125em;
        fill: currentColor;
      }

      .nav-scroller {
        position: relative;
        z-index: 2;
        height: 2.75rem;
        overflow-y: hidden;
      }

      .nav-scroller .nav {
        display: flex;
        flex-wrap: nowrap;
        padding-bottom: 1rem;
        margin-top: -1px;
        overflow-x: auto;
        text-align: center;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
      }

      .captcha-group {
        display: flex;
        align-items: center;
        gap: 10px;
      }
    </style>
    <!-- Custom styles for this template -->
    <link href="{{ url_for('main.static', filename='css/sign-in.css') }}" rel="stylesheet">
    <!-- <link href="../static/resources/css/sign-in.css" rel="stylesheet"> -->
</head>
<body class="text-center">
    <main class="form-signin w-100 m-auto">
        {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
          <div class="alert alert-danger" role="alert">
            {% for category, message in messages %}
              {{ message }}
            {% endfor %}
          </div>
        {% endif %}
      {% endwith %}
      <form id="loginForm" method="post" action="/api/user/login">
        <img class="mb-4" src="images/登录/zf.svg" alt="" width="72" height="57">
        <h1 class="h3 mb-3 fw-normal">ZF-AI</h1>

        <div class="form-floating">
          <input type="text" class="form-control" id="username" name="username" placeholder="UserName" required>
          <label for="username">UserName</label>
        </div>
        <div class="form-floating">
          <input type="password" class="form-control" id="password" name="password" placeholder="Password" required>
          <label for="password">Password</label>
        </div>

        <div class="captcha-group">
          <div class="form-floating captcha">
            <input type="text" class="form-control" id="captcha" name="captcha" placeholder="Captcha" required>
            <label for="captcha">Captcha</label>
          </div>
          <img id="captchaImage" src="" alt="Captcha" class="captcha">
        </div>

        <button class="w-100 btn btn-lg btn-primary" type="submit">登  录</button>
        <p class="mt-5 mb-3 text-muted">&copy; 2024–2025 ZFKJ All Rights Reserved</p>
      </form>
    </main>
    <script>
      const form = document.getElementById('loginForm');
      const captchaImage = document.getElementById('captchaImage');
      captchaImage.src = '/api/user/code?' + new Date().getTime();

      form.addEventListener('submit', function(event) {

      });

      function showError(errorText) {
        alert(errorText);
      }
    </script>
</body>
</html>