<?php
/*
 * package examples/crash_reporter/backend/views/login.php
 * login.php
 * Created at: Wed 20 May 2026 14:31:55 +0200
 * Updated at: Wed 20 May 2026 15:17:13 +0200 by Anton Afanasyeu <a.afanasieff@gmail.com>
 * Commit: 5d8e82d2e60a21fff3138d2a394ee4e8b4c6dcb8
 * Contributors:
 *    - Anton Afanasyeu <a.afanasieff@gmail.com> (2 commits, 27 lines)
 *    - Cursor Agent (project assistant)
 * Digest: SHA256	9bef983f4d34cb790922cda355ccf5d14b565b29273d2ebfe48b3173cd2e8f9f
 */
$bp = Auth::basePath();
?>
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Login — <?= h(cfg('app_name')) ?></title>
  <script>
    (function () {
      var t = localStorage.getItem('crash_console_theme');
      if (t === 'light' || t === 'dark') document.documentElement.setAttribute('data-theme', t);
      var l = localStorage.getItem('crash_console_lang');
      if (l === 'en' || l === 'ru') document.documentElement.setAttribute('lang', l);
    })();
  </script>
  <link rel="stylesheet" href="<?= h($bp) ?>/assets/css/app.css">
  <script src="<?= h($bp) ?>/assets/js/i18n.js" defer></script>
  <?php AnalyticsHead::render('crashes_login'); ?>
</head>
<body class="login-page" data-base-path="<?= h($bp) ?>">
  <div class="login-locale">
    <label class="toolbar-select locale-toolbar-select" data-i18n-title="lang.label" title="Language">
      <span class="locale-flag" aria-hidden="true">🇬🇧</span>
      <select class="lang-select" data-i18n-aria="lang.label" aria-label="Language">
        <option value="en">EN</option>
        <option value="ru">RU</option>
      </select>
    </label>
  </div>
  <form class="login-card" method="post" action="<?= h($bp) ?>/login">
    <h1><?= h(cfg('app_name')) ?></h1>
    <p class="muted" data-i18n="login.sign_in_hint">Sign in to view anonymous issue reports</p>
    <?php if (!empty($loginError)): ?>
      <div class="alert" data-i18n="login.error"><?= h($loginError) ?></div>
    <?php endif; ?>
    <label><span data-i18n="login.username">Username</span><input name="username" autocomplete="username" required></label>
    <label><span data-i18n="login.password">Password</span><input name="password" type="password" autocomplete="current-password" required></label>
    <button type="submit" data-i18n="login.submit">Sign in</button>
    <p class="hint" data-i18n="login.hint_default">Default: admin / admin</p>
    <p class="hint"><a href="<?= h($bp) ?>/register" data-i18n="login.register">Register</a></p>
  </form>
  <?php platform_render_footer(); ?>
</body>
</html>
