Show previous keys if exist in order confirmation
This commit is contained in:
		
					parent
					
						
							
								110f29171d
							
						
					
				
			
			
				commit
				
					
						ecc26d14e5
					
				
			
		
					 2 changed files with 11 additions and 2 deletions
				
			
		| 
						 | 
					@ -151,6 +151,15 @@
 | 
				
			||||||
                <div class="dashboard-container-head">
 | 
					                <div class="dashboard-container-head">
 | 
				
			||||||
                    <h2 class="dashboard-title-thin"><i class="fa fa-key" aria-hidden="true"></i> {% trans "Add your public SSH key" %}</h2>
 | 
					                    <h2 class="dashboard-title-thin"><i class="fa fa-key" aria-hidden="true"></i> {% trans "Add your public SSH key" %}</h2>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
 | 
					            <div class="previous-keys">
 | 
				
			||||||
 | 
					                {% if keys|length > 0 %}
 | 
				
			||||||
 | 
					                <div class="previous-keys-title">Previous keys</div>
 | 
				
			||||||
 | 
					                {% endif %}
 | 
				
			||||||
 | 
					                {% for key in keys %}
 | 
				
			||||||
 | 
					                <textarea cols="79" readonly  oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"'></textarea>
 | 
				
			||||||
 | 
					                    <br/>
 | 
				
			||||||
 | 
					                {% endfor %}
 | 
				
			||||||
 | 
					            </>
 | 
				
			||||||
                {% for field in form %}
 | 
					                {% for field in form %}
 | 
				
			||||||
                    {% bootstrap_field field %}
 | 
					                    {% bootstrap_field field %}
 | 
				
			||||||
                {% endfor %}
 | 
					                {% endfor %}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,7 @@ from utils.forms import (
 | 
				
			||||||
    BillingAddressForm, BillingAddressFormSignup, UserBillingAddressForm,
 | 
					    BillingAddressForm, BillingAddressFormSignup, UserBillingAddressForm,
 | 
				
			||||||
    BillingAddress
 | 
					    BillingAddress
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from utils.hosting_utils import get_vm_price_with_vat
 | 
					from utils.hosting_utils import get_vm_price_with_vat, get_all_public_keys
 | 
				
			||||||
from utils.stripe_utils import StripeUtils
 | 
					from utils.stripe_utils import StripeUtils
 | 
				
			||||||
from utils.tasks import send_plain_email_task
 | 
					from utils.tasks import send_plain_email_task
 | 
				
			||||||
from .cms_models import DCLCalculatorPluginModel
 | 
					from .cms_models import DCLCalculatorPluginModel
 | 
				
			||||||
| 
						 | 
					@ -575,6 +575,7 @@ class OrderConfirmationView(DetailView, FormView):
 | 
				
			||||||
            context.update({
 | 
					            context.update({
 | 
				
			||||||
                'vm': request.session.get('specs'),
 | 
					                'vm': request.session.get('specs'),
 | 
				
			||||||
                'form': UserHostingKeyForm(request=self.request),
 | 
					                'form': UserHostingKeyForm(request=self.request),
 | 
				
			||||||
 | 
					                'keys': get_all_public_keys(self.request.user)
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
        context.update({
 | 
					        context.update({
 | 
				
			||||||
            'site_url': reverse('datacenterlight:index'),
 | 
					            'site_url': reverse('datacenterlight:index'),
 | 
				
			||||||
| 
						 | 
					@ -607,7 +608,6 @@ class OrderConfirmationView(DetailView, FormView):
 | 
				
			||||||
        # We have a valid SSH key from the user, save it in opennebula and db
 | 
					        # We have a valid SSH key from the user, save it in opennebula and db
 | 
				
			||||||
        # and proceed further
 | 
					        # and proceed further
 | 
				
			||||||
        form.save()
 | 
					        form.save()
 | 
				
			||||||
        user_public_key = form.data["public_key"]
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if 'token' in request.session:
 | 
					        if 'token' in request.session:
 | 
				
			||||||
            card_details = stripe_utils.get_cards_details_from_token(
 | 
					            card_details = stripe_utils.get_cards_details_from_token(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue