##// END OF EJS Templates
auth-tokens: add scope and show consitent token UI for my account and admin.
auth-tokens: add scope and show consitent token UI for my account and admin.

File last commit:

r1480:a9c54e36 default
r1480:a9c54e36 default
Show More
user_edit_auth_tokens.mako
97 lines | 4.3 KiB | application/x-mako | MakoHtmlLexer
/ rhodecode / templates / admin / users / user_edit_auth_tokens.mako
templating: use .mako as extensions for template files.
r1282 <div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">${_('Authentication Access Tokens')}</h3>
</div>
<div class="panel-body">
<div class="apikeys_wrap">
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 <p>
${_('Each token can have a role. Token with a role can be used only in given context, '
'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')}
${_('Additionally scope for VCS type token can narrow the use to chosen repository.')}
</p>
templating: use .mako as extensions for template files.
r1282 <table class="rctable auth_tokens">
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 <tr>
<th>${_('Token')}</th>
<th>${_('Scope')}</th>
<th>${_('Description')}</th>
<th>${_('Role')}</th>
<th>${_('Expiration')}</th>
<th>${_('Action')}</th>
</tr>
templating: use .mako as extensions for template files.
r1282 %if c.user_auth_tokens:
%for auth_token in c.user_auth_tokens:
<tr class="${'expired' if auth_token.expired else ''}">
<td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${auth_token.api_key}</code></div></td>
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 <td class="td">${auth_token.scope_humanized}</td>
templating: use .mako as extensions for template files.
r1282 <td class="td-wrap">${auth_token.description}</td>
<td class="td-tags">
<span class="tag">${auth_token.role_humanized}</span>
</td>
<td class="td-exp">
%if auth_token.expires == -1:
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 ${_('never')}
templating: use .mako as extensions for template files.
r1282 %else:
%if auth_token.expired:
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 <span style="text-decoration: line-through">${h.age_component(h.time_to_utcdatetime(auth_token.expires))}</span>
templating: use .mako as extensions for template files.
r1282 %else:
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 ${h.age_component(h.time_to_utcdatetime(auth_token.expires))}
templating: use .mako as extensions for template files.
r1282 %endif
%endif
</td>
<td>
${h.secure_form(url('edit_user_auth_tokens', user_id=c.user.user_id),method='delete')}
${h.hidden('del_auth_token',auth_token.api_key)}
<button class="btn btn-link btn-danger" type="submit"
onclick="return confirm('${_('Confirm to remove this auth token: %s') % auth_token.api_key}');">
${_('Delete')}
</button>
${h.end_form()}
</td>
</tr>
%endfor
%else:
<tr><td><div class="ip">${_('No additional auth tokens specified')}</div></td></tr>
%endif
</table>
</div>
<div class="user_auth_tokens">
${h.secure_form(url('edit_user_auth_tokens', user_id=c.user.user_id), method='put')}
<div class="form form-vertical">
<!-- fields -->
<div class="fields">
<div class="field">
<div class="label">
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 <label for="new_email">${_('New authentication token')}:</label>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="input">
${h.text('description', class_='medium', placeholder=_('Description'))}
${h.select('lifetime', '', c.lifetime_options)}
${h.select('role', '', c.role_options)}
</div>
</div>
<div class="buttons">
${h.submit('save',_('Add'),class_="btn btn-small")}
${h.reset('reset',_('Reset'),class_="btn btn-small")}
</div>
</div>
</div>
${h.end_form()}
</div>
</div>
</div>
<script>
$(document).ready(function(){
$("#lifetime").select2({
'containerCssClass': "drop-menu",
'dropdownCssClass': "drop-menu-dropdown",
'dropdownAutoWidth': true
});
$("#role").select2({
'containerCssClass': "drop-menu",
'dropdownCssClass': "drop-menu-dropdown",
'dropdownAutoWidth': true
});
})
</script>