##// END OF EJS Templates
SSH: disable visually support ssh keys if we have them disabled in the .ini
marcink -
r2045:2161e3c4 default
parent child Browse files
Show More
@@ -41,6 +41,9 b' class MyAccountSshKeysView(BaseAppView, '
41 def load_default_context(self):
41 def load_default_context(self):
42 c = self._get_local_tmpl_context()
42 c = self._get_local_tmpl_context()
43 c.user = c.auth_user.get_instance()
43 c.user = c.auth_user.get_instance()
44
45 c.ssh_enabled = self.request.registry.settings.get(
46 'ssh.generate_authorized_keyfile')
44 self._register_global_c(c)
47 self._register_global_c(c)
45 return c
48 return c
46
49
@@ -11,32 +11,37 b''
11 <th>${_('Created')}</th>
11 <th>${_('Created')}</th>
12 <th>${_('Action')}</th>
12 <th>${_('Action')}</th>
13 </tr>
13 </tr>
14 %if c.user_ssh_keys:
14 % if not c.ssh_enabled:
15 %for ssh_key in c.user_ssh_keys:
15 <tr><td colspan="4"><div class="">${_('SSH Keys usage is currently disabled, please ask your administrator to enable them.')}</div></td></tr>
16 <tr class="">
16 % else:
17 <td class="">
17 %if c.user_ssh_keys:
18 <code>${ssh_key.ssh_key_fingerprint}</code>
18 %for ssh_key in c.user_ssh_keys:
19 </td>
19 <tr class="">
20 <td class="td-wrap">${ssh_key.description}</td>
20 <td class="">
21 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
21 <code>${ssh_key.ssh_key_fingerprint}</code>
22 </td>
23 <td class="td-wrap">${ssh_key.description}</td>
24 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
22
25
23 <td class="td-action">
26 <td class="td-action">
24 ${h.secure_form(h.route_path('my_account_ssh_keys_delete'), method='POST', request=request)}
27 ${h.secure_form(h.route_path('my_account_ssh_keys_delete'), method='POST', request=request)}
25 ${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
28 ${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
26 <button class="btn btn-link btn-danger" type="submit"
29 <button class="btn btn-link btn-danger" type="submit"
27 onclick="return confirm('${_('Confirm to remove ssh key %s') % ssh_key.ssh_key_fingerprint}');">
30 onclick="return confirm('${_('Confirm to remove ssh key %s') % ssh_key.ssh_key_fingerprint}');">
28 ${_('Delete')}
31 ${_('Delete')}
29 </button>
32 </button>
30 ${h.end_form()}
33 ${h.end_form()}
31 </td>
34 </td>
32 </tr>
35 </tr>
33 %endfor
36 %endfor
34 %else:
37 %else:
35 <tr><td><div class="ip">${_('No additional ssh keys specified')}</div></td></tr>
38 <tr><td colspan="4"><div class="">${_('No additional ssh keys specified')}</div></td></tr>
36 %endif
39 %endif
40 % endif
37 </table>
41 </table>
38 </div>
42 </div>
39
43
44 % if c.ssh_enabled:
40 <div class="user_ssh_keys">
45 <div class="user_ssh_keys">
41 ${h.secure_form(h.route_path('my_account_ssh_keys_add'), method='POST', request=request)}
46 ${h.secure_form(h.route_path('my_account_ssh_keys_add'), method='POST', request=request)}
42 <div class="form form-vertical">
47 <div class="form form-vertical">
@@ -66,6 +71,7 b''
66 </div>
71 </div>
67 ${h.end_form()}
72 ${h.end_form()}
68 </div>
73 </div>
74 % endif
69 </div>
75 </div>
70 </div>
76 </div>
71
77
General Comments 0
You need to be logged in to leave comments. Login now