mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +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:
parent
3a864cd203
commit
fff0a6c562
@ -33,6 +33,7 @@ All notable changes to this project will be documented in this file.
|
||||
- networks: Fixed incorrect access for retrieving DNS entries.
|
||||
- Fixed issue with lost menus in Django 1.10.
|
||||
- Added workaround for script prefix problem in stronghold.
|
||||
- users: Fixed editing users without SSH keys.
|
||||
|
||||
### Changed
|
||||
- Added suggested packages for ikiwiki. Removed recommends since they
|
||||
|
||||
@ -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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user