Fixed Login Error Style , Started view to generating SSH key for a VM
This commit is contained in:
parent
e26eecf2eb
commit
5bdcc5d2b2
9 changed files with 88 additions and 8 deletions
|
|
@ -3,8 +3,8 @@ from django.shortcuts import get_object_or_404, render
|
|||
from django.core.urlresolvers import reverse_lazy, reverse
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
|
||||
from django.views.generic import View, CreateView, FormView, ListView, DetailView
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.views.generic import View, CreateView, FormView, ListView, DetailView, UpdateView
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.contrib.auth import authenticate, login
|
||||
from django.conf import settings
|
||||
|
||||
|
|
@ -145,6 +145,30 @@ class SignupView(CreateView):
|
|||
return HttpResponseRedirect(self.get_success_url())
|
||||
|
||||
|
||||
class GenerateVMSSHKeysView(LoginRequiredMixin, UpdateView):
|
||||
model = VirtualMachinePlan
|
||||
template_name = 'hosting/virtual_machine_key.html'
|
||||
success_url = reverse_lazy('hosting:orders')
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
private_key, public_key = VirtualMachinePlan.generate_RSA()
|
||||
context = {
|
||||
'private_key': private_key
|
||||
}
|
||||
return context
|
||||
|
||||
# def get(self, *args, **kwargs):
|
||||
# vm = self.get_object()
|
||||
# private_key, public_key = VirtualMachinePlan.generate_RSA()
|
||||
# print(private_key)
|
||||
# print(public_key)
|
||||
# key_name = "private_key"
|
||||
# response = HttpResponse(content_type='text/plain')
|
||||
# response['Content-Disposition'] = 'attachment; filename="%s.pem"' % key_name
|
||||
# response.write(private_key)
|
||||
# return response
|
||||
# return HttpResponseRedirect(reverse(''))
|
||||
|
||||
class PaymentVMView(LoginRequiredMixin, FormView):
|
||||
template_name = 'hosting/payment.html'
|
||||
login_url = reverse_lazy('hosting:login')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue