Redirecting new user to my virtual machines page and not forcing ssh key for creating a vm
This commit is contained in:
		
					parent
					
						
							
								537e350c8c
							
						
					
				
			
			
				commit
				
					
						300997699a
					
				
			
		
					 2 changed files with 12 additions and 19 deletions
				
			
		|  | @ -13,7 +13,12 @@ | ||||||
|         {% endif %} |         {% endif %} | ||||||
|         {% if not error %} |         {% if not error %} | ||||||
|             <div class="dashboard-subtitle"> |             <div class="dashboard-subtitle"> | ||||||
|                 <p>{% trans 'To create a new virtual machine, click "Create VM"' %}</p> |                 <p>{% trans 'To create a new virtual machine, click "Create VM"' %} | ||||||
|  |                 {% if show_create_ssh_key_msg %} | ||||||
|  |                      {% url 'hosting:create_ssh_key' as create_ssh_url %} | ||||||
|  |                      <br/>{% blocktrans %}To access your VM, add your SSH key <a href="{{create_ssh_url}}">here</a>{% endblocktrans %} | ||||||
|  |                 {% endif %} | ||||||
|  |                 </p> | ||||||
|                 <div class="text-right"> |                 <div class="text-right"> | ||||||
|                     <a class="btn btn-vm" href="{% url 'hosting:create_virtual_machine' %}"><span class="css-plus"></span> <span>{% trans "CREATE VM" %}</span></a> |                     <a class="btn btn-vm" href="{% url 'hosting:create_virtual_machine' %}"><span class="css-plus"></span> <span>{% trans "CREATE VM" %}</span></a> | ||||||
|                 </div> |                 </div> | ||||||
|  |  | ||||||
|  | @ -592,13 +592,6 @@ class PaymentVMView(LoginRequiredMixin, FormView): | ||||||
|         return context |         return context | ||||||
| 
 | 
 | ||||||
|     def get(self, request, *args, **kwargs): |     def get(self, request, *args, **kwargs): | ||||||
|         if not UserHostingKey.objects.filter(user=self.request.user).exists(): |  | ||||||
|             messages.success( |  | ||||||
|                 request, |  | ||||||
|                 'In order to create a VM, you create/upload your SSH KEY first.' |  | ||||||
|             ) |  | ||||||
|             return HttpResponseRedirect(reverse('hosting:ssh_keys')) |  | ||||||
| 
 |  | ||||||
|         if 'next' in request.session: |         if 'next' in request.session: | ||||||
|             del request.session['next'] |             del request.session['next'] | ||||||
| 
 | 
 | ||||||
|  | @ -834,6 +827,10 @@ class VirtualMachinesPlanListView(LoginRequiredMixin, ListView): | ||||||
|             context = {'error': 'connection'} |             context = {'error': 'connection'} | ||||||
|         else: |         else: | ||||||
|             context = super(ListView, self).get_context_data(**kwargs) |             context = super(ListView, self).get_context_data(**kwargs) | ||||||
|  |             if UserHostingKey.objects.filter(user=self.request.user).exists(): | ||||||
|  |                 context['show_create_ssh_key_msg'] = False | ||||||
|  |             else: | ||||||
|  |                 context['show_create_ssh_key_msg'] = True | ||||||
|         return context |         return context | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -842,15 +839,6 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View): | ||||||
|     login_url = reverse_lazy('hosting:login') |     login_url = reverse_lazy('hosting:login') | ||||||
| 
 | 
 | ||||||
|     def get(self, request, *args, **kwargs): |     def get(self, request, *args, **kwargs): | ||||||
| 
 |  | ||||||
|         if not UserHostingKey.objects.filter(user=self.request.user).exists(): |  | ||||||
|             messages.success( |  | ||||||
|                 request, |  | ||||||
|                 _( |  | ||||||
|                     'In order to create a VM, you need to create/upload your SSH KEY first.') |  | ||||||
|             ) |  | ||||||
|             return HttpResponseRedirect(reverse('hosting:ssh_keys')) |  | ||||||
| 
 |  | ||||||
|         try: |         try: | ||||||
|             manager = OpenNebulaManager() |             manager = OpenNebulaManager() | ||||||
|             templates = manager.get_templates() |             templates = manager.get_templates() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue