mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
users: Fix editing users without SSH keys
When SSH keys are not available for a user, the current user edit form errors out. Fix this by ignoring ssh key load errors.
This commit is contained in:
1 parent
3a864cd203
commit
fff0a6c562
2 files changed
+8
-2
No files matched your search
@@ -88,8 +88,13 @@ class UserUpdate(ContextMixin, SuccessMessageMixin, UpdateView):
|
||||
def get_initial(self):
|
||||
"""Return the data for initial form load."""
|
||||
initial = super(UserUpdate, self).get_initial()
|
||||
initial['ssh_keys'] = actions.superuser_run(
|
||||
'ssh', ['get-keys', '--username', self.object.username]).strip()
|
||||
try:
|
||||
ssh_keys = actions.superuser_run(
|
||||
'ssh', ['get-keys', '--username', self.object.username])
|
||||
initial['ssh_keys'] = ssh_keys.strip()
|
||||
except ActionError:
|
||||
pass
|
||||
|
||||
return initial
|
||||
|
||||
def get_success_url(self):
|
||||
|
||||
Reference in new issue
Block a user