##// END OF EJS Templates
auth-tokens: improve UI.
marcink -
r3391:d889da9e default
parent child Browse files
Show More
@@ -1130,10 +1130,10 b' class UserApiKeys(Base, BaseModel):'
1130 1130
1131 1131 def _get_scope(self):
1132 1132 if self.repo:
1133 return repr(self.repo)
1133 return 'Repository: {}'.format(self.repo.repo_name)
1134 1134 if self.repo_group:
1135 return repr(self.repo_group) + ' (recursive)'
1136 return 'global'
1135 return 'RepositoryGroup: {} (recursive)'.format(self.repo_group.group_name)
1136 return 'Global'
1137 1137
1138 1138 @property
1139 1139 def scope_humanized(self):
@@ -1,35 +1,36 b''
1 1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Authentication Tokens')}</h3>
4 </div>
5 <div class="panel-body">
4 </div>
5 <div class="panel-body">
6 6 <div class="apikeys_wrap">
7 7 <p>
8 ${_('Each token can have a role. Token with a role can be used only in given context, '
8 ${_('Authentication tokens can be used to interact with the API, or VCS-over-http. '
9 'Each token can have a role. Token with a role can be used only in given context, '
9 10 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')}
10 11 </p>
11 12 <table class="rctable auth_tokens">
12 13 <tr>
13 14 <th>${_('Token')}</th>
14 <th>${_('Scope')}</th>
15 15 <th>${_('Description')}</th>
16 16 <th>${_('Role')}</th>
17 <th>${_('Repository Scope')}</th>
17 18 <th>${_('Expiration')}</th>
18 19 <th>${_('Action')}</th>
19 20 </tr>
20 21 %if c.user_auth_tokens:
21 22 %for auth_token in c.user_auth_tokens:
22 <tr class="${'expired' if auth_token.expired else ''}">
23 <tr class="${('expired' if auth_token.expired else '')}">
23 24 <td class="truncate-wrap td-authtoken">
24 25 <div class="user_auth_tokens truncate autoexpand">
25 26 <code>${auth_token.api_key}</code>
26 27 </div>
27 28 </td>
28 <td class="td">${auth_token.scope_humanized}</td>
29 29 <td class="td-wrap">${auth_token.description}</td>
30 30 <td class="td-tags">
31 31 <span class="tag disabled">${auth_token.role_humanized}</span>
32 32 </td>
33 <td class="td">${auth_token.scope_humanized}</td>
33 34 <td class="td-exp">
34 35 %if auth_token.expires == -1:
35 36 ${_('never')}
@@ -58,40 +59,41 b''
58 59 </table>
59 60 </div>
60 61
61 <div class="user_auth_tokens">
62 ${h.secure_form(h.route_path('my_account_auth_tokens_add'), request=request)}
63 <div class="form form-vertical">
64 <!-- fields -->
65 <div class="fields">
66 <div class="field">
67 <div class="label">
68 <label for="new_email">${_('New authentication token')}:</label>
69 </div>
70 <div class="input">
71 ${h.text('description', class_='medium', placeholder=_('Description'))}
72 ${h.hidden('lifetime')}
73 ${h.select('role', '', c.role_options)}
62 <div class="user_auth_tokens">
63 ${h.secure_form(h.route_path('my_account_auth_tokens_add'), request=request)}
64 <div class="form form-vertical">
65 <!-- fields -->
66 <div class="fields">
67 <div class="field">
68 <div class="label">
69 <label for="new_email">${_('New authentication token')}:</label>
70 </div>
71 <div class="input">
72 ${h.text('description', class_='medium', placeholder=_('Description'))}
73 ${h.hidden('lifetime')}
74 ${h.select('role', '', c.role_options)}
74 75
75 % if c.allow_scoped_tokens:
76 ${h.hidden('scope_repo_id')}
77 % else:
78 ${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')}
79 % endif
80 </div>
81 <p class="help-block">
82 ${_('Repository scope works only with tokens with VCS type.')}
83 </p>
84 </div>
85 <div class="buttons">
86 ${h.submit('save',_('Add'),class_="btn")}
87 ${h.reset('reset',_('Reset'),class_="btn")}
76 % if c.allow_scoped_tokens:
77 ${h.hidden('scope_repo_id')}
78 % else:
79 ${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')}
80 % endif
88 81 </div>
82 <p class="help-block">
83 ${_('Repository scope works only with tokens with VCS type.')}
84 </p>
85 </div>
86 <div class="buttons">
87 ${h.submit('save',_('Add'),class_="btn")}
88 ${h.reset('reset',_('Reset'),class_="btn")}
89 89 </div>
90 90 </div>
91 ${h.end_form()}
92 91 </div>
92 ${h.end_form()}
93 </div>
93 94 </div>
94 95 </div>
96
95 97 <script>
96 98 $(document).ready(function(){
97 99
@@ -5,27 +5,32 b''
5 5 <div class="panel-body">
6 6 <div class="apikeys_wrap">
7 7 <p>
8 ${_('Each token can have a role. Token with a role can be used only in given context, '
8 ${_('Authentication tokens can be used to interact with the API, or VCS-over-http. '
9 'Each token can have a role. Token with a role can be used only in given context, '
9 10 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')}
10 11 </p>
11 12 <table class="rctable auth_tokens">
12 13 <tr>
13 14 <th>${_('Token')}</th>
14 <th>${_('Scope')}</th>
15 15 <th>${_('Description')}</th>
16 16 <th>${_('Role')}</th>
17 <th>${_('Repository Scope')}</th>
17 18 <th>${_('Expiration')}</th>
18 19 <th>${_('Action')}</th>
19 20 </tr>
20 21 %if c.user_auth_tokens:
21 22 %for auth_token in c.user_auth_tokens:
22 <tr class="${'expired' if auth_token.expired else ''}">
23 <td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${auth_token.api_key}</code></div></td>
24 <td class="td">${auth_token.scope_humanized}</td>
23 <tr class="${('expired' if auth_token.expired else '')}">
24 <td class="truncate-wrap td-authtoken">
25 <div class="user_auth_tokens truncate autoexpand">
26 <code>${auth_token.api_key}</code>
27 </div>
28 </td>
25 29 <td class="td-wrap">${auth_token.description}</td>
26 30 <td class="td-tags">
27 31 <span class="tag disabled">${auth_token.role_humanized}</span>
28 32 </td>
33 <td class="td">${auth_token.scope_humanized}</td>
29 34 <td class="td-exp">
30 35 %if auth_token.expires == -1:
31 36 ${_('never')}
General Comments 0
You need to be logged in to leave comments. Login now