Set new_user_hosting_key_id session variable to track newly created key
This commit is contained in:
parent
ddaa320628
commit
26fab27c3f
1 changed files with 10 additions and 7 deletions
|
@ -225,6 +225,7 @@ class SSHKeyCreateView(FormView):
|
||||||
'form': UserHostingKeyForm(request=self.request),
|
'form': UserHostingKeyForm(request=self.request),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if self.request.user.is_authenticated():
|
||||||
owner = self.request.user
|
owner = self.request.user
|
||||||
manager = OpenNebulaManager(
|
manager = OpenNebulaManager(
|
||||||
email=owner.email,
|
email=owner.email,
|
||||||
|
@ -232,6 +233,8 @@ class SSHKeyCreateView(FormView):
|
||||||
)
|
)
|
||||||
keys_to_save = get_all_public_keys(self.request.user)
|
keys_to_save = get_all_public_keys(self.request.user)
|
||||||
manager.save_key_in_opennebula_user('\n'.join(keys_to_save))
|
manager.save_key_in_opennebula_user('\n'.join(keys_to_save))
|
||||||
|
else:
|
||||||
|
self.request.session["new_user_hosting_key_id"] = form.instance.id
|
||||||
return HttpResponseRedirect(self.success_url)
|
return HttpResponseRedirect(self.success_url)
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue