{% extends "dash.html" %}
{% block main %}
 {% if formErrors %}<div id="formBody" class="alert alert-warning" role="alert"><p>Form Error:</p><ul>
 {% for l in formErrors %}
  <li><em>{{ l }}</em></li>
 {% end %}
 </ul></div>
 {% end %}
 <div id="formBody" class="bg-body-tertiary p-2 rounded">
 {% if user and oldName %}
  <h2 class="my-3">Edit User</h2>
 {% else %}
  <h2 class="my-3">Add New User</h2>
 {% end %}
 <form action="/user/{{ site.pathQuote(oldName) }}" method="POST">
 <input type="hidden" name="oldName" value="{{ oldName }}">
 <div class="form-floating">
  <input type="text" {{ 'disabled' if adminuser else '' }} class="form-control" id="username" name="username" placeholder="username" value="{{ user }}">
  <label for="username" class="form-label">Username</label>
 </div>
 <div class="form-floating mb-3">
  <input type="text" class="form-control" id="password" name="password" placeholder="password" value="{{ tmpPass }}">
  <label for="password" class="form-label">{{ 'Password' if tmpPass else 'New Password' }}</label>
 </div>
 <button class="btn btn-primary py-2 mb-3" type="submit">
 {{ 'Update User' if user else 'Create User' }}
 </button> 
 </form>
 </div>
{% end %}
