<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Account &bull; <%= appName %></title>
  <%- headAssets %>
</head>
<body>

  <%- topNav %>

  <main class="admin-container">

    <div class="page-header">
      <div>
        <h1 class="page-title">My account</h1>
        <p class="page-subtitle">Your details and password</p>
      </div>
    </div>

    <% if (mustChangePassword) { %>
      <div class="flash-alert error"><span><strong>Action required.</strong> You are using a temporary password. Choose your own below to continue.</span></div>
    <% } %>
    <% if (error) { %>
      <div class="flash-alert error"><span><%= error %></span></div>
    <% } %>

    <div class="two-col">
      <div class="form-card">
        <h2 class="card-title">Change password</h2>
        <p class="card-note">Use at least 12 characters. A passphrase of several unrelated words works well.</p>
        <form method="POST" action="<%= url('account') %>" autocomplete="off">
          <%- csrfField %>
          <div class="form-group">
            <label class="form-label" for="current_password">Current password</label>
            <input type="password" id="current_password" name="current_password" class="form-control" required>
          </div>
          <div class="form-group">
            <label class="form-label" for="new_password">New password</label>
            <input type="password" id="new_password" name="new_password" class="form-control" required minlength="12">
          </div>
          <div class="form-group form-group-last">
            <label class="form-label" for="confirm_password">Confirm new password</label>
            <input type="password" id="confirm_password" name="confirm_password" class="form-control" required minlength="12">
          </div>
          <button type="submit" class="btn btn-primary btn-block">Save new password</button>
        </form>
      </div>

      <div class="form-card">
        <h2 class="card-title">Your details</h2>
        <dl class="detail-list">
          <dt>Name</dt><dd><%= user.full_name || '-' %></dd>
          <dt>Username</dt><dd><%= user.username %></dd>
          <dt>Email</dt><dd><%= user.email %></dd>
          <dt>Role</dt><dd>Member</dd>
          <dt>Applications</dt>
          <dd><%= apps.length ? apps.map((a) => a.name).join(', ') : 'None assigned yet' %></dd>
        </dl>
      </div>
    </div>

  </main>

  <%- shellEnd %>
</body>
</html>

