SSH: disable visually support ssh keys if we have them disabled in the .ini
This commit is contained in:
parent
b7c17b192d
commit
ededb0c7ff
2 changed files with 31 additions and 22 deletions
|
|
@ -41,6 +41,9 @@ class MyAccountSshKeysView(BaseAppView, DataGridAppView):
|
|||
def load_default_context(self):
|
||||
c = self._get_local_tmpl_context()
|
||||
c.user = c.auth_user.get_instance()
|
||||
|
||||
c.ssh_enabled = self.request.registry.settings.get(
|
||||
'ssh.generate_authorized_keyfile')
|
||||
self._register_global_c(c)
|
||||
return c
|
||||
|
||||
|
|
|
|||
|
|
@ -11,32 +11,37 @@
|
|||
<th>${_('Created')}</th>
|
||||
<th>${_('Action')}</th>
|
||||
</tr>
|
||||
%if c.user_ssh_keys:
|
||||
%for ssh_key in c.user_ssh_keys:
|
||||
<tr class="">
|
||||
<td class="">
|
||||
<code>${ssh_key.ssh_key_fingerprint}</code>
|
||||
</td>
|
||||
<td class="td-wrap">${ssh_key.description}</td>
|
||||
<td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
|
||||
% if not c.ssh_enabled:
|
||||
<tr><td colspan="4"><div class="">${_('SSH Keys usage is currently disabled, please ask your administrator to enable them.')}</div></td></tr>
|
||||
% else:
|
||||
%if c.user_ssh_keys:
|
||||
%for ssh_key in c.user_ssh_keys:
|
||||
<tr class="">
|
||||
<td class="">
|
||||
<code>${ssh_key.ssh_key_fingerprint}</code>
|
||||
</td>
|
||||
<td class="td-wrap">${ssh_key.description}</td>
|
||||
<td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
|
||||
|
||||
<td class="td-action">
|
||||
${h.secure_form(h.route_path('my_account_ssh_keys_delete'), method='POST', request=request)}
|
||||
${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
|
||||
<button class="btn btn-link btn-danger" type="submit"
|
||||
onclick="return confirm('${_('Confirm to remove ssh key %s') % ssh_key.ssh_key_fingerprint}');">
|
||||
${_('Delete')}
|
||||
</button>
|
||||
${h.end_form()}
|
||||
</td>
|
||||
</tr>
|
||||
%endfor
|
||||
%else:
|
||||
<tr><td><div class="ip">${_('No additional ssh keys specified')}</div></td></tr>
|
||||
%endif
|
||||
<td class="td-action">
|
||||
${h.secure_form(h.route_path('my_account_ssh_keys_delete'), method='POST', request=request)}
|
||||
${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
|
||||
<button class="btn btn-link btn-danger" type="submit"
|
||||
onclick="return confirm('${_('Confirm to remove ssh key %s') % ssh_key.ssh_key_fingerprint}');">
|
||||
${_('Delete')}
|
||||
</button>
|
||||
${h.end_form()}
|
||||
</td>
|
||||
</tr>
|
||||
%endfor
|
||||
%else:
|
||||
<tr><td colspan="4"><div class="">${_('No additional ssh keys specified')}</div></td></tr>
|
||||
%endif
|
||||
% endif
|
||||
</table>
|
||||
</div>
|
||||
|
||||
% if c.ssh_enabled:
|
||||
<div class="user_ssh_keys">
|
||||
${h.secure_form(h.route_path('my_account_ssh_keys_add'), method='POST', request=request)}
|
||||
<div class="form form-vertical">
|
||||
|
|
@ -66,6 +71,7 @@
|
|||
</div>
|
||||
${h.end_form()}
|
||||
</div>
|
||||
% endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue