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

{% block title %}Account Settings | {{ block.super }}{% endblock %}
{% block pagetitle %}Account Settings{% endblock %}

{% block kb-account-main %}

{% if user.is_staff or user.is_superuser %}
<h2>API Access</h2>
<p>
  Use this API key to access the kegbot web service. Ssh! Keep it secret!
</p>

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

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

{% else %}
<h2>Hello, {{user.username}}!</h2>
{% endif %}

{% endblock %}
