Add basic implementation of AskSSHKeyView

This commit is contained in:
PCoder 2019-07-01 06:45:48 +05:30
parent d5d90e0790
commit f502e53845
2 changed files with 23 additions and 2 deletions

View file

@ -523,13 +523,33 @@ class PaymentOrderView(FormView):
else: else:
request.session['customer'] = customer request.session['customer'] = customer
return HttpResponseRedirect( return HttpResponseRedirect(
reverse('datacenterlight:order_confirmation')) reverse('datacenterlight:add_ssh_key'))
else: else:
context = self.get_context_data() context = self.get_context_data()
context['billing_address_form'] = address_form context['billing_address_form'] = address_form
return self.render_to_response(context) return self.render_to_response(context)
class AskSSHKeyView(FormView):
form_class = UserHostingKeyForm
template_name = "datacenterlight/add_ssh_key.html"
def get_form_kwargs(self):
kwargs = super(AskSSHKeyView, self).get_form_kwargs()
kwargs.update({'request': self.request})
return kwargs
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
def get(self, request, *args, **kwargs):
context = {
'site_url': reverse('datacenterlight:index'),
'cms_integration': get_cms_integration('default'),
'form': UserHostingKeyForm(request=self.request),
'keys': get_all_public_keys(self.request.user)
}
return render(request, self.template_name, context)
class OrderConfirmationView(DetailView, FormView): class OrderConfirmationView(DetailView, FormView):
form_class = UserHostingKeyForm form_class = UserHostingKeyForm
template_name = "datacenterlight/order_detail.html" template_name = "datacenterlight/order_detail.html"

View file

@ -8,7 +8,8 @@
<form method="POST" action="" novalidate class="form-ssh"> <form method="POST" action="" novalidate class="form-ssh">
{% csrf_token %} {% csrf_token %}
<div class="page-header"> <div class="page-header">
<h1 class="h1-thin"><i class="fa fa-key" aria-hidden="true"></i>&nbsp;{% trans "Add your public SSH key" %}</h1> <h1 class="h1-thin"><i class="fa fa-key" aria-hidden="true"></i>&nbsp;{% if title %}{% trans title %}{% else %} {% endif %}</h1>
{% if sub_title %}<span>{% trans sub_title %}</span>{% else %}{% endif %}
</div> </div>
{% if messages %} {% if messages %}
<div class="alert alert-warning"> <div class="alert alert-warning">