<div class="pure-u-1">
    <p>
        This page allows you to add, view and remove tokens from your distillery account.
    </p>
</div>

<div class="pure-u-2-3">
    <h2>My Tokens</h2>
    <p>
        This table shows tokens currently associated with your account.
        Tokens can be used to access the API programatically.
    </p>
    <div class="padding">
        <div class="overflow">

            <table class="pure-table pure-table-bordered">
                <thead>
                    <tr>
                        <th>
                            ID
                        </th>
                        <th>
                            Token
                        </th>
                        <th>
                            Description
                        </th>
                        <th>
                            Actions
                        </th>
                    </tr>
                </thead>
                <tbody>
                    {{ $csrf := .CSRF }}
                    {{ range .Tokens }}
                        <tr>
                            <td>
                                <code class="copy">{{ .TokenID }}</code>
                            </td>
                            <td>
                                (only shown once)
                            </td>
                            <td>
                                {{ .Description }}
                            </td>
                            <td>
                                <div class="pure-button-group" role="group">
                                    <form action="/user/tokens/delete" method="POST" class="pure-form-group">
                                        <input type="hidden" name="id" value="{{ .TokenID }}">
                                        <input type="submit" class="pure-button pure-button-danger" value="Delete">
                                        {{ $csrf }}
                                    </form>
                                </div>
                            </td>
                        </tr>
                    {{ end }}
                </tbody>
            </table>
        </div>
    </div>
</div>

<div class="pure-u-1-3">
    <p>
        To check if a token is working, you can use something like:
    </p>
    <code class="copy">
        curl -H "Authorization: Bearer <b>&lt;token&gt;</b>" {{ .Domain }}api/v1/auth
    </code>
    <p>
        When using a working token, you should get a response with <code>Token: true</code> in it.
    </p>
</div>