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,13 +225,16 @@ class SSHKeyCreateView(FormView):
'form': UserHostingKeyForm(request=self.request), 'form': UserHostingKeyForm(request=self.request),
}) })
owner = self.request.user if self.request.user.is_authenticated():
manager = OpenNebulaManager( owner = self.request.user
email=owner.email, manager = OpenNebulaManager(
password=owner.password email=owner.email,
) password=owner.password
keys_to_save = get_all_public_keys(self.request.user) )
manager.save_key_in_opennebula_user('\n'.join(keys_to_save)) 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) return HttpResponseRedirect(self.success_url)
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):