<%ARGS>
$Token => undef
$TokenObj => undef
$Error => ''
</%ARGS>
<%INIT>
if (!$TokenObj) {
    $TokenObj = RT::AuthToken->new($session{CurrentUser});
    $TokenObj->Load($Token);
}

Abort("Unable to load authentication token") if !$TokenObj->Id;
Abort("Permission Denied") if !$TokenObj->CurrentUserCanSee;
</%INIT>
<form class="authtoken-form" method="post" data-ajax-url="<% RT->Config->Get('WebPath') %>/Helpers/AuthToken/Modify" action="<% RT->Config->Get('WebPath') %><% $r->uri %>">
% if ($Error) {
<p class="error"><% $Error %></p>
% }

% if ($ARGS{id}) {
<input type="hidden" name="id" value="<% $ARGS{id} %>">
% }

<input type="hidden" name="ShowModifyForm" value="1">
<input type="hidden" name="Token" value="<% $TokenObj->id %>">
<table>
<tr>
<td class="label"><&|/l&>Description</&>:<br><em><&|/l&>What's this token for?</&></em></td>
<td class="value"><input type="text" name="Description" value="<% $ARGS{Description} // $TokenObj->Description %>" size="16" /></td>
</tr>
<tr>
<td class="label"><&|/l&>Last Used</&>:</td>
<td class="value">
% my $used = $TokenObj->LastUsedObj;
% if ($used->IsSet) {
       <% $used->AgeAsString %>
% } else {
       <&|/l&>never</&>
% }
</td>
</tr>
<tr>
<td class="label"><&|/l&>Created</&>:</td>
<td class="value"><% $TokenObj->CreatedObj->AgeAsString %></td>
</tr>
</table>

<div class="buttons">
<input type="submit" name="Update" value="<&|/l&>Save</&>"></input>
<input type="submit" name="Revoke" value="<&|/l&>Revoke</&>"></input>
</div>

<span class="loading"><img src="<%RT->Config->Get('WebPath')%>/static/images/loading.gif" alt="<%loc('Loading')%>" title="<%loc('Loading')%>" /></span>
</form>
