##// END OF EJS Templates
pkgs: bump to 4.23.2
pkgs: bump to 4.23.2

File last commit:

r4430:d880ce51 default
r4597:6bbf3b00 stable
Show More
my_account_auth_tokens.mako
205 lines | 7.1 KiB | application/x-mako | MakoHtmlLexer
/ rhodecode / templates / admin / my_account / my_account_auth_tokens.mako
templating: use .mako as extensions for template files.
r1282 <div class="panel panel-default">
users: added more secure way for fetching authentication tokens....
r4316 <script>
var showAuthToken = function(authTokenId) {
return _showAuthToken(authTokenId, pyroutes.url('my_account_auth_tokens_view'))
}
</script>
auth-tokens: improve UI.
r3391 <div class="panel-heading">
templating: use .mako as extensions for template files.
r1282 <h3 class="panel-title">${_('Authentication Tokens')}</h3>
auth-tokens: improve UI.
r3391 </div>
<div class="panel-body">
admin: moved auth tokens into pyramid view....
r1518 <div class="apikeys_wrap">
templating: use .mako as extensions for template files.
r1282 <p>
auth-tokens: expose all roles with explanation to help users understand it better.
r4430 ${_('Available roles')}:
<ul>
% for role in h.UserApiKeys.ROLES:
<li>
<span class="tag disabled">${h.UserApiKeys._get_role_name(role)}</span>
<span>${h.UserApiKeys._get_role_description(role) |n}</span>
</li>
% endfor
</ul>
templating: use .mako as extensions for template files.
r1282 </p>
<table class="rctable auth_tokens">
admin: moved auth tokens into pyramid view....
r1518 <tr>
<th>${_('Token')}</th>
<th>${_('Description')}</th>
<th>${_('Role')}</th>
auth-tokens: improve UI.
r3391 <th>${_('Repository Scope')}</th>
admin: moved auth tokens into pyramid view....
r1518 <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:
auth-tokens: improve UI.
r3391 <tr class="${('expired' if auth_token.expired else '')}">
users: added more secure way for fetching authentication tokens....
r4316 <td class="td-authtoken">
<div class="user_auth_tokens">
<code class="cursor-pointer" onclick="showAuthToken(${auth_token.user_api_key_id})">
${auth_token.token_obfuscated}
</code>
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 </div>
</td>
templating: use .mako as extensions for template files.
r1282 <td class="td-wrap">${auth_token.description}</td>
<td class="td-tags">
auth-tokens: expose all roles with explanation to help users understand it better.
r4430 <span class="tooltip tag disabled" title="${h.UserApiKeys._get_role_description(auth_token.role)}">${auth_token.role_humanized}</span>
templating: use .mako as extensions for template files.
r1282 </td>
auth-tokens: improve UI.
r3391 <td class="td">${auth_token.scope_humanized}</td>
templating: use .mako as extensions for template files.
r1282 <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 class="td-action">
forms: unified usage of h.secure_form. Make sure we ALWAYS pass in...
r2105 ${h.secure_form(h.route_path('my_account_auth_tokens_delete'), request=request)}
users: added more secure way for fetching authentication tokens....
r4316 <input name="del_auth_token" type="hidden" value="${auth_token.user_api_key_id}">
templating: use .mako as extensions for template files.
r1282 <button class="btn btn-link btn-danger" type="submit"
templates: switched most of confirm dialogs to sweetalert2
r4313 onclick="submitConfirm(event, this, _gettext('Confirm to delete this auth token'), _gettext('Delete'), '${auth_token.token_obfuscated}')"
>
templating: use .mako as extensions for template files.
r1282 ${_('Delete')}
</button>
${h.end_form()}
</td>
</tr>
%endfor
%else:
admin: moved auth tokens into pyramid view....
r1518 <tr><td><div class="ip">${_('No additional auth tokens specified')}</div></td></tr>
templating: use .mako as extensions for template files.
r1282 %endif
</table>
admin: moved auth tokens into pyramid view....
r1518 </div>
templating: use .mako as extensions for template files.
r1282
auth-tokens: improve UI.
r3391 <div class="user_auth_tokens">
${h.secure_form(h.route_path('my_account_auth_tokens_add'), request=request)}
<div class="form form-vertical">
<!-- fields -->
<div class="fields">
<div class="field">
<div class="label">
<label for="new_email">${_('New authentication token')}:</label>
</div>
<div class="input">
${h.text('description', class_='medium', placeholder=_('Description'))}
${h.hidden('lifetime')}
user-accounts: show info about password for external accounts.
r4240 ${h.select('role', request.GET.get('token_role', ''), c.role_options)}
auth-tokens: extended views to allowed override of adding scope in EE edition.
r1507
auth-tokens: improve UI.
r3391 % if c.allow_scoped_tokens:
${h.hidden('scope_repo_id')}
% else:
${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')}
% endif
templating: use .mako as extensions for template files.
r1282 </div>
auth-tokens: improve UI.
r3391 <p class="help-block">
${_('Repository scope works only with tokens with VCS type.')}
</p>
</div>
<div class="buttons">
${h.submit('save',_('Add'),class_="btn")}
${h.reset('reset',_('Reset'),class_="btn")}
templating: use .mako as extensions for template files.
r1282 </div>
</div>
</div>
auth-tokens: improve UI.
r3391 ${h.end_form()}
</div>
templating: use .mako as extensions for template files.
r1282 </div>
</div>
auth-tokens: improve UI.
r3391
auth-tokens: extended views to allowed override of adding scope in EE edition.
r1507 <script>
$(document).ready(function(){
var select2Options = {
'containerCssClass': "drop-menu",
'dropdownCssClass': "drop-menu-dropdown",
'dropdownAutoWidth': true
};
$("#role").select2(select2Options);
auth-tokens: allow specifing custom expiration date manually....
r2083 var preloadData = {
results: [
% for entry in c.lifetime_values:
{id:${entry[0]}, text:"${entry[1]}"}${'' if loop.last else ','}
% endfor
]
};
$("#lifetime").select2({
containerCssClass: "drop-menu",
dropdownCssClass: "drop-menu-dropdown",
dropdownAutoWidth: true,
data: preloadData,
auth-tokens: fix placeholder text
r2084 placeholder: "${_('Select or enter expiration date')}",
auth-tokens: allow specifing custom expiration date manually....
r2083 query: function(query) {
feedLifetimeOptions(query, preloadData);
}
});
auth-tokens: extended views to allowed override of adding scope in EE edition.
r1507 var repoFilter = function(data) {
var results = [];
if (!data.results[0]) {
return data
}
$.each(data.results[0].children, function() {
// replace name to ID for submision
repo-switcher: new unified search box for filtering/accessing users, repos and repo groups....
r2774 this.id = this.repo_id;
auth-tokens: extended views to allowed override of adding scope in EE edition.
r1507 results.push(this);
});
data.results[0].children = results;
return data;
};
$("#scope_repo_id_disabled").select2(select2Options);
repo-auth-tokens: UX, set and disable to VCS scope if selected an repo from select2
r2118 var selectVcsScope = function() {
// select vcs scope and disable input
$("#role").select2("val", "${c.role_vcs}").trigger('change');
$("#role").select2("readonly", true)
};
auth-tokens: extended views to allowed override of adding scope in EE edition.
r1507 $("#scope_repo_id").select2({
cachedDataSource: {},
minimumInputLength: 2,
placeholder: "${_('repository scope')}",
dropdownAutoWidth: true,
containerCssClass: "drop-menu",
dropdownCssClass: "drop-menu-dropdown",
repo-switcher: new unified search box for filtering/accessing users, repos and repo groups....
r2774 formatResult: formatRepoResult,
auth-tokens: extended views to allowed override of adding scope in EE edition.
r1507 query: $.debounce(250, function(query){
self = this;
var cacheKey = query.term;
var cachedData = self.cachedDataSource[cacheKey];
if (cachedData) {
query.callback({results: cachedData.results});
} else {
$.ajax({
core: moved repo_list data to pyramid.
r1667 url: pyroutes.url('repo_list_data'),
auth-tokens: extended views to allowed override of adding scope in EE edition.
r1507 data: {'query': query.term},
dataType: 'json',
type: 'GET',
success: function(data) {
data = repoFilter(data);
self.cachedDataSource[cacheKey] = data;
query.callback({results: data.results});
},
error: function(data, textStatus, errorThrown) {
alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
}
})
}
})
});
repo-auth-tokens: UX, set and disable to VCS scope if selected an repo from select2
r2118 $("#scope_repo_id").on('select2-selecting', function(e){
selectVcsScope()
});
auth-tokens: extended views to allowed override of adding scope in EE edition.
r1507
});
</script>