<!DOCTYPE html>
<html xml:lang="de" lang="de"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/">
    <xi:include href="layout.html" />

<head/>

<body>
    <h2>Manage user access for wiki: <a href="https://systemausfall.org/wikis/${zone}" target="_blank">${zone}</a></h2>

    <div py:if="error" class="alert alert-danger" role="alert">${error}</div>
    <div py:if="success" class="alert alert-success">${success}</div>

    <div class="row">
    <div class="col-xs-12 col-sm-6 col-md-4 col-sm-offset-3 col-md-offset-4">
    <h3>Add user</h3>
    <form name="add-passwd" action="" method="POST">
      <div class="form-group">
        <label for="username_add">User name:</label>
        <input type="text" name="username" id="username_add" class="form-control"/>
      </div>
      <div class="form-group">
        <label for="password_add">Password:</label>
        <input type="password" name="password" id="password_add" class="form-control"/>
      </div>
        <input type="hidden" name="action" value="new" />
        <input type="hidden" name="zone" value="${zone}"/>
        <button type="submit" name="submit" class="btn btn-primary">Add user</button>
    </form>

    <py:if test="usernames">
        <hr/>

        <h3>Change password</h3>
        <form name="update-passwd" action="" method="POST">
          <div class="form-group">
            <label for="username_update">User name:</label>
            <select name="username" id="username_update" class="form-control">
                <option py:for="username in usernames">${username}</option>
            </select>
	  </div>
          <div class="form-group">
            <label for="password_update">New password:</label>
            <input type="password" name="password" id="password_update" class="form-control"/>
          </div>
            <input type="hidden" name="action" value="update" />
            <input type="hidden" name="zone" value="${zone}"/>
            <button type="submit" name="submit" class="btn btn-primary">Change password</button>
        </form>

        <hr/>

        <h3>Delete user</h3>
        <form name="del-passwd" action="" method="POST">
          <div class="form-group">
            <label for="username_del">User name:</label>
            <select name="username" id="username_del" class="form-control">
                <option py:for="username in usernames">${username}</option>
            </select>
           </div>
            <input type="hidden" name="action" value="del" />
            <input type="hidden" name="zone" value="${zone}"/>
            <button type="submit" name="submit" class="btn btn-primary">Delete user</button>
        </form>
    </py:if>
    </div>
    </div>
</body>
</html>