{% extends "account/base.html" %}
{% load bootstrap %}

{% block pagetitle %}Your Account{% endblock %}

{% block kb-account-main %}
<h2>Hello, {{user.username}}!</h2>

<div class="row">
  <div class="span11">
    <div class="well">
      <form action="" method="POST">{% csrf_token %}
        {{ profile_form|bootstrap }}
        <div class="actions">
          <button type="submit" class="btn primary">Update Profile</button>
        </div>
      </form>
    </div>
  </div>
</div>

{% if user.is_staff or user.is_superuser %}
<h2>API Access</h2>
<div class="row">
  <div class="span11">

    <p>
      Use this API key to access the kegbot web service. Ssh! Keep it secret!
    </p>

    <pre>{{ user.get_profile.GetApiKey.Encode }}</pre>

    <form action="regenerate-api-key/" method="POST">
    {% csrf_token %}
    {{ apikey_form.as_p }}
    <button type="submit" class="btn primary">Regenerate API Key</button>
    </form>
  </div>
</div>
{% endif %}
{% endblock %}
