diff --git a/rhodecode/apps/my_account/views/my_account_ssh_keys.py b/rhodecode/apps/my_account/views/my_account_ssh_keys.py --- a/rhodecode/apps/my_account/views/my_account_ssh_keys.py +++ b/rhodecode/apps/my_account/views/my_account_ssh_keys.py @@ -41,6 +41,9 @@ class MyAccountSshKeysView(BaseAppView, 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 diff --git a/rhodecode/templates/admin/my_account/my_account_ssh_keys.mako b/rhodecode/templates/admin/my_account/my_account_ssh_keys.mako --- a/rhodecode/templates/admin/my_account/my_account_ssh_keys.mako +++ b/rhodecode/templates/admin/my_account/my_account_ssh_keys.mako @@ -11,32 +11,37 @@ ${_('Created')} ${_('Action')} - %if c.user_ssh_keys: - %for ssh_key in c.user_ssh_keys: - - - ${ssh_key.ssh_key_fingerprint} - - ${ssh_key.description} - ${h.format_date(ssh_key.created_on)} + % if not c.ssh_enabled: +
${_('SSH Keys usage is currently disabled, please ask your administrator to enable them.')}
+ % else: + %if c.user_ssh_keys: + %for ssh_key in c.user_ssh_keys: + + + ${ssh_key.ssh_key_fingerprint} + + ${ssh_key.description} + ${h.format_date(ssh_key.created_on)} - - ${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)} - - ${h.end_form()} - - - %endfor - %else: -
${_('No additional ssh keys specified')}
- %endif + + ${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)} + + ${h.end_form()} + + + %endfor + %else: +
${_('No additional ssh keys specified')}
+ %endif + % endif + % if c.ssh_enabled:
${h.secure_form(h.route_path('my_account_ssh_keys_add'), method='POST', request=request)}
@@ -66,6 +71,7 @@
${h.end_form()}
+ % endif