Set new_user_hosting_key_id session variable to track newly created key

This commit is contained in:
PCoder 2019-07-01 23:17:27 +05:30
parent ddaa320628
commit 26fab27c3f

View file

@ -225,6 +225,7 @@ class SSHKeyCreateView(FormView):
'form': UserHostingKeyForm(request=self.request),
})
if self.request.user.is_authenticated():
owner = self.request.user
manager = OpenNebulaManager(
email=owner.email,
@ -232,6 +233,8 @@ class SSHKeyCreateView(FormView):
)
keys_to_save = get_all_public_keys(self.request.user)
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)
def post(self, request, *args, **kwargs):