Merged master into task/3622/decouple_opennebula_dcl_flow
This commit is contained in:
commit
6b7ae88f74
19 changed files with 296 additions and 142 deletions
|
|
@ -14,7 +14,6 @@ def generate_ssh_key_name():
|
|||
|
||||
|
||||
class HostingUserLoginForm(forms.Form):
|
||||
|
||||
email = forms.CharField(widget=forms.EmailInput())
|
||||
password = forms.CharField(widget=forms.PasswordInput())
|
||||
|
||||
|
|
@ -45,7 +44,6 @@ class HostingUserLoginForm(forms.Form):
|
|||
|
||||
|
||||
class HostingUserSignupForm(forms.ModelForm):
|
||||
|
||||
confirm_password = forms.CharField(widget=forms.PasswordInput())
|
||||
password = forms.CharField(widget=forms.PasswordInput())
|
||||
|
||||
|
|
@ -88,9 +86,8 @@ class UserHostingKeyForm(forms.ModelForm):
|
|||
|
||||
def clean(self):
|
||||
cleaned_data = self.cleaned_data
|
||||
if not self.cleaned_data.get('name', ''):
|
||||
if 'generate' in self.request.POST:
|
||||
self.cleaned_data['name'] = generate_ssh_key_name()
|
||||
if not cleaned_data.get('public_key'):
|
||||
private_key, public_key = UserHostingKey.generate_keys()
|
||||
cleaned_data.update({
|
||||
'private_key': private_key,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-08-04 18:25+0000\n"
|
||||
"POT-Creation-Date: 2017-08-11 01:16+0530\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
@ -393,14 +393,14 @@ msgstr ""
|
|||
msgid "Delete SSH Key"
|
||||
msgstr "SSH Key löschen"
|
||||
|
||||
msgid "Do You want to delete this key?"
|
||||
msgid "Do you want to delete this key?"
|
||||
msgstr "Möchtest Du den Schlüssel löschen?"
|
||||
|
||||
msgid "Show"
|
||||
msgstr "Anzeigen"
|
||||
|
||||
msgid "Public ssh key"
|
||||
msgstr ""
|
||||
msgid "Public SSH Key"
|
||||
msgstr "Public SSH Key"
|
||||
|
||||
msgid "Download"
|
||||
msgstr ""
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
}
|
||||
|
||||
.content-dashboard{
|
||||
min-height: calc(100vh - 120px);
|
||||
min-height: calc(100vh - 70px);
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
max-width: 1120px;
|
||||
|
|
@ -110,12 +110,16 @@
|
|||
font-weight: 100;
|
||||
color: #999;
|
||||
}
|
||||
.modal-body .modal-icon {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.modal-title {
|
||||
margin: 0;
|
||||
line-height: 1.42857143;
|
||||
font-size: 25px;
|
||||
padding: 0;
|
||||
font-family: 'Lato', sans-serif;
|
||||
/*font-family: 'Lato', sans-serif;*/
|
||||
font-weight: 300;
|
||||
}
|
||||
.modal-text {
|
||||
padding-top: 15px;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*/
|
||||
|
||||
@font-face {
|
||||
/*@font-face {
|
||||
font-family: 'Lato-Regular';
|
||||
src: url('../fonts/Lato/Lato-Regular.ttf');
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
@font-face {
|
||||
font-family: 'Lato-Light';
|
||||
src: url('../fonts/Lato/Lato-Light.ttf');
|
||||
}
|
||||
}*/
|
||||
|
||||
body,
|
||||
html {
|
||||
|
|
@ -31,8 +31,9 @@ h3,
|
|||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: 'Lato-Regular', sans-serif;
|
||||
font-weight: 300;
|
||||
/*font-family: 'Lato-Regular', sans-serif;*/
|
||||
font-family: 'Lato', sans-serif;
|
||||
/*font-weight: 300;*/
|
||||
}
|
||||
|
||||
.topnav {
|
||||
|
|
@ -53,7 +54,8 @@ h6 {
|
|||
.navbar-transparent .navbar-nav>li>a {
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
font-family: 'Lato-Regular', sans-serif;
|
||||
/*font-family: 'Lato-Regular', sans-serif;*/
|
||||
font-weight: normal;
|
||||
}
|
||||
.navbar-transparent .navbar-nav>li>a:hover {
|
||||
color: #fff;
|
||||
|
|
@ -376,7 +378,8 @@ h6 {
|
|||
text-align: center;
|
||||
font-size: 18px;
|
||||
line-height: 30px;
|
||||
font-family: 'Lato' !important;
|
||||
/*font-family: 'Lato' !important;*/
|
||||
font-weight: 300 !important;
|
||||
}
|
||||
|
||||
.sign-up-message a {
|
||||
|
|
@ -454,16 +457,16 @@ h6 {
|
|||
}
|
||||
|
||||
footer {
|
||||
padding: 2%;
|
||||
padding: 20px;
|
||||
background-color: #f8f8f8;
|
||||
#position: absolute;
|
||||
/* position: absolute */
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
p.copyright {
|
||||
margin: 15px 0 0;
|
||||
margin: 14px 0 0;
|
||||
}
|
||||
|
||||
a#forgotpassword {
|
||||
|
|
@ -488,7 +491,8 @@ a.unlink:hover {
|
|||
|
||||
/***** DCL payment page **********/
|
||||
.dcl-order-container {
|
||||
font-family: Lato;
|
||||
/*font-family: Lato;*/
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.dcl-order-table-header {
|
||||
|
|
@ -547,11 +551,16 @@ a.unlink:hover {
|
|||
}
|
||||
|
||||
.card-warning-content {
|
||||
font-family: Lato;
|
||||
/*font-family: Lato;*/
|
||||
font-weight: 300;
|
||||
border: 1px solid #a1a1a1;
|
||||
border-radius: 3px;
|
||||
padding: 5px;
|
||||
}
|
||||
.card-warning-error {
|
||||
border: 1px solid #EB4D5C;
|
||||
color: #EB4D5C;
|
||||
}
|
||||
|
||||
.card-warning-addtional-margin {
|
||||
margin-top: 15px;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
font-size: 14px;
|
||||
padding-left: 0;
|
||||
margin-bottom: 30px;
|
||||
font-family: 'Lato';
|
||||
font-family: Lato, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* ssh_keys_choice */
|
||||
.h1-thin {
|
||||
font-family: Lato, sans-serif;
|
||||
/*font-family: Lato, sans-serif;*/
|
||||
font-weight: 300;
|
||||
font-size: 32px;
|
||||
}
|
||||
|
|
@ -10,12 +10,12 @@
|
|||
}
|
||||
.dashboard-choice-container .page-header p {
|
||||
font-size: 16px;
|
||||
font-family: Lato, sans-serif;
|
||||
/*font-family: Lato, sans-serif;*/
|
||||
font-weight: 300;
|
||||
}
|
||||
.dashboard-choice-container h2 {
|
||||
font-family: Lato, sans-serif;
|
||||
font-weight: 400;
|
||||
/*font-family: Lato, sans-serif;
|
||||
font-weight: 400;*/
|
||||
font-size: 22px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
}
|
||||
.choice-container p{
|
||||
font-size: 18px;
|
||||
font-family: Lato, sans-serif;
|
||||
/*font-family: Lato, sans-serif;*/
|
||||
font-weight: 300;
|
||||
}
|
||||
.choice-container-top {
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
color: #717274;
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
font-family: 'Lato';
|
||||
/*font-family: 'Lato';*/
|
||||
}
|
||||
|
||||
.borderless tbody:before {
|
||||
|
|
@ -195,7 +195,8 @@
|
|||
border-bottom: 1px solid grey;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
font-family: 'Lato-Light', sans-serif;
|
||||
/*font-family: 'Lato-Light', sans-serif;*/
|
||||
font-weight: 300;
|
||||
font-size: 20px;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
|
@ -203,57 +204,58 @@
|
|||
.form_key_name::-webkit-input-placeholder{
|
||||
font-size: 20px;
|
||||
font-weight:100;
|
||||
font-family: 'Lato-Light', sans-serif;
|
||||
/*font-family: 'Lato-Light', sans-serif;*/
|
||||
font-weight: 300;
|
||||
|
||||
|
||||
}
|
||||
.form_key_name::-moz-input-placeholder{
|
||||
font-size: 20px;
|
||||
font-weight:200;
|
||||
font-family: 'Lato-Light', sans-serif;
|
||||
/*font-family: 'Lato-Light', sans-serif;*/
|
||||
font-weight: 300;
|
||||
|
||||
}
|
||||
.form_key_name:-moz-input-placeholder{
|
||||
font-family: 'Lato-Light', sans-serif;
|
||||
/*font-family: 'Lato-Light', sans-serif;*/
|
||||
font-weight: 300;
|
||||
font-size: 20px;
|
||||
font-weight:200;
|
||||
|
||||
}
|
||||
.form_key_name:-ms-input-placeholder {
|
||||
font-size: 20px;
|
||||
font-family: 'Lato-Light', sans-serif;
|
||||
font-weight:200;
|
||||
/*font-family: 'Lato-Light', sans-serif;*/
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.form_public_key::-webkit-input-placeholder{
|
||||
position: relative;
|
||||
top: 110px;
|
||||
font-size: 20px;
|
||||
font-weight: 200;
|
||||
font-family: 'Lato-Light', sans-serif;
|
||||
/*font-family: 'Lato-Light', sans-serif;*/
|
||||
font-weight: 300;
|
||||
|
||||
}
|
||||
.form_public_key::-moz-input-placeholder{
|
||||
position: relative;
|
||||
top: 110px;
|
||||
font-size: 20px;
|
||||
font-family: 'Lato-Light', sans-serif;
|
||||
font-weight:200;
|
||||
/*font-family: 'Lato-Light', sans-serif;*/
|
||||
font-weight: 300;
|
||||
|
||||
}
|
||||
.form_public_key:-moz-input-placeholder{
|
||||
position: relative;
|
||||
top: 110px;
|
||||
font-size: 20px;
|
||||
font-weight:200;
|
||||
font-family: 'Lato-Light', sans-serif;
|
||||
/*font-family: 'Lato-Light', sans-serif;*/
|
||||
font-weight: 300;
|
||||
}
|
||||
.form_public_key:-ms-input-placeholder {
|
||||
position: relative;
|
||||
top: 110px;
|
||||
font-size: 20px;
|
||||
font-weight:200;
|
||||
font-family: 'Lato-Light', sans-serif;
|
||||
/*font-family: 'Lato-Light', sans-serif;*/
|
||||
font-weight: 300;
|
||||
}
|
||||
.underform-contaner{
|
||||
margin-bottom: 20px;
|
||||
|
|
@ -273,7 +275,8 @@
|
|||
}
|
||||
}
|
||||
.underform-contaner h4{
|
||||
font-family: 'Lato-Light', sans-serif;
|
||||
/*font-family: 'Lato-Light', sans-serif;*/
|
||||
font-weight: 300;
|
||||
}
|
||||
.underform-contaner button{
|
||||
/* font-family: Lato; */
|
||||
|
|
@ -287,13 +290,16 @@
|
|||
color: #fff;
|
||||
}
|
||||
.control-label{
|
||||
font-family: 'Lato-Light', sans-serif;
|
||||
/*font-family: 'Lato-Light', sans-serif;*/
|
||||
font-weight: 300;
|
||||
font-size: 20px;
|
||||
font-weight:200;
|
||||
}
|
||||
.form-ssh h3{
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.key_contain {
|
||||
word-break: break-all;
|
||||
}
|
||||
.custom_form_button{
|
||||
border-radius: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@
|
|||
{% csrf_token %}
|
||||
{% bootstrap_field field show_label=False type='fields'%}
|
||||
{% endfor %}
|
||||
{% bootstrap_form_errors form type='non_fields'%}
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-7 col-md-6 creditcard-box dcl-creditcard">
|
||||
|
|
@ -86,13 +85,29 @@
|
|||
</form>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<p class="card-warning-content card-warning-addtional-margin">
|
||||
{% blocktrans %}
|
||||
You are not making any payment yet. After submitting your card
|
||||
information, you will be taken to the Confirm Order Page.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
</div>
|
||||
{% if not messages and not form.non_field_errors %}
|
||||
<p class="card-warning-content card-warning-addtional-margin">
|
||||
{% blocktrans %}
|
||||
You are not making any payment yet. After submitting your card
|
||||
information, you will be taken to the Confirm Order Page.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
<div id='payment_error'>
|
||||
{% for message in messages %}
|
||||
{% if 'failed_payment' or 'make_charge_error' in message.tags %}
|
||||
<ul class="list-unstyled"><li>
|
||||
<p class="card-warning-content card-warning-error">{{ message|safe }}</p>
|
||||
</li></ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for error in form.non_field_errors %}
|
||||
<p class="card-warning-content card-warning-error">
|
||||
{{ error|escape }}
|
||||
</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
<div class="col-xs-6 pull-right">
|
||||
<button id="payment_button_with_creditcard" class="btn btn-success stripe-payment-btn"
|
||||
|
|
@ -130,12 +145,29 @@
|
|||
<div id="card-errors" role="alert"></div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<p class="card-warning-content">
|
||||
{% blocktrans %}
|
||||
You are not making any payment yet. After submitting your card
|
||||
information, you will be taken to the Confirm Order Page.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% if not messages and not form.non_field_errors %}
|
||||
<p class="card-warning-content">
|
||||
{% blocktrans %}
|
||||
You are not making any payment yet. After submitting your card
|
||||
information, you will be taken to the Confirm Order Page.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
<div id='payment_error'>
|
||||
{% for message in messages %}
|
||||
{% if 'failed_payment' or 'make_charge_error' in message.tags %}
|
||||
<ul class="list-unstyled"><li>
|
||||
<p class="card-warning-content card-warning-error">{{ message|safe }}</p>
|
||||
</li></ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% for error in form.non_field_errors %}
|
||||
<p class="card-warning-content card-warning-error">
|
||||
{{ error|escape }}
|
||||
</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
<div class="col-xs-6 pull-right">
|
||||
|
|
@ -150,15 +182,6 @@
|
|||
<p class="payment-errors"></p>
|
||||
</div>
|
||||
</div>
|
||||
{% if paymentError %}
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<p>
|
||||
{% bootstrap_alert paymentError alert_type='danger' %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
<div class="modal-body">
|
||||
<div class="modal-icon"><i class="fa fa-trash" aria-hidden="true"></i></div>
|
||||
<h4 class="modal-title" id="ModalLabel">{% trans "Delete SSH Key"%}</h4>
|
||||
<p class="modal-text">{% trans "Do You want to delete this key?"%}</p>
|
||||
<p class="modal-text">{% trans "Do you want to delete this key?"%}</p>
|
||||
<form method="post" action="{% url 'hosting:delete_ssh_key' user_key.id %}">
|
||||
{% csrf_token %}
|
||||
<div class="modal-footer">
|
||||
|
|
@ -77,8 +77,8 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h4 class="modal-title" id="ModalLabel_Public_Key">{% trans "Public ssh key" %}</h4>
|
||||
<p style="margin-top: 10px;">{{ user_key.public_key }}</p>
|
||||
<h4 class="modal-title" id="ModalLabel_Public_Key">{% trans "Public SSH key" %}</h4>
|
||||
<p class="key_contain" style="margin-top: 10px;">{{ user_key.public_key }}</p>
|
||||
<div class="modal-footer">
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
{% extends "hosting/base_short.html" %}
|
||||
{% load staticfiles bootstrap3 i18n %}
|
||||
{% block content %}
|
||||
{% block content %}
|
||||
<div>
|
||||
<div class="dashboard-container">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 container-table">
|
||||
<table class="table borderless table-hover">
|
||||
<h3 class="pull-left"><i class="fa fa-server fa-separate" aria-hidden="true"></i> {% trans "Virtual Machines"%} </h3>
|
||||
<table class="table borderless table-hover">
|
||||
<h3 class="pull-left"><i class="fa fa-server fa-separate" aria-hidden="true"></i> {% trans "Virtual Machines"%}</h3>
|
||||
<div class="col-md-12">
|
||||
<br/>
|
||||
{% if messages %}
|
||||
|
|
@ -19,12 +19,12 @@
|
|||
</div>
|
||||
{% if not error %}
|
||||
<p class="pull-right btn-create-vm">
|
||||
<a class="btn btn-success" href="{% url 'hosting:create_virtual_machine' %}" >{% trans "Create VM"%} </a>
|
||||
<a class="btn btn-success" href="{% url 'hosting:create_virtual_machine' %}" >{% trans "Create VM"%} </a>
|
||||
</p>
|
||||
<br/>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "ID"%}</th>
|
||||
<th>{% trans "Ipv4"%}</th>
|
||||
<th>{% trans "Ipv6"%}</th>
|
||||
|
|
@ -32,36 +32,36 @@
|
|||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody>
|
||||
{% for vm in vms %}
|
||||
<tr>
|
||||
<td scope="row">{{vm.vm_id}}</td>
|
||||
<td scope="row">{{vm.vm_id}}</td>
|
||||
{% if vm.ipv6 %}
|
||||
<td>{{vm.ipv4}}</td>
|
||||
|
||||
<td>{{vm.ipv6}}</td>
|
||||
<td>{{vm.ipv4}}</td>
|
||||
|
||||
<td>{{vm.ipv6}}</td>
|
||||
{% endif %}
|
||||
|
||||
<td>
|
||||
|
||||
|
||||
{% if vm.state == 'ACTIVE' %}
|
||||
<span class="h3 label label-success"><strong> {{vm.state}}</strong></span>
|
||||
{% elif vm.state == 'FAILED' %}
|
||||
<span class="h3 label label-danger"><strong>{{vm.state}}</strong></span>
|
||||
{% else %}
|
||||
<span class="h3 label label-warning"><strong>{{vm.state}}</strong></span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
</td>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-default"><a
|
||||
href="{% url 'hosting:virtual_machines' vm.vm_id %}">{% trans "View Detail"%}</a></button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</tbody>
|
||||
{% endif %}
|
||||
</table>
|
||||
|
||||
{% if is_paginated %}
|
||||
<div class="pagination">
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -210,9 +210,9 @@ class SignupValidateView(TemplateView):
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super(SignupValidateView, self).get_context_data(**kwargs)
|
||||
login_url = '<a href="' + \
|
||||
reverse('hosting:login') + '">' + str(_('login')) + '</a>'
|
||||
reverse('hosting:login') + '">' + str(_('login')) + '</a>'
|
||||
home_url = '<a href="' + \
|
||||
reverse('datacenterlight:index') + '">Data Center Light</a>'
|
||||
reverse('datacenterlight:index') + '">Data Center Light</a>'
|
||||
message = '{signup_success_message} {lurl}</a> \
|
||||
<br />{go_back} {hurl}.'.format(
|
||||
signup_success_message=_(
|
||||
|
|
@ -234,7 +234,7 @@ class SignupValidatedView(SignupValidateView):
|
|||
context = super(SignupValidateView, self).get_context_data(**kwargs)
|
||||
validated = CustomUser.validate_url(self.kwargs['validate_slug'])
|
||||
login_url = '<a href="' + \
|
||||
reverse('hosting:login') + '">' + str(_('login')) + '</a>'
|
||||
reverse('hosting:login') + '">' + str(_('login')) + '</a>'
|
||||
section_title = _('Account activation')
|
||||
if validated:
|
||||
message = '{account_activation_string} <br /> {login_string} {lurl}.'.format(
|
||||
|
|
@ -244,7 +244,7 @@ class SignupValidatedView(SignupValidateView):
|
|||
lurl=login_url)
|
||||
else:
|
||||
home_url = '<a href="' + \
|
||||
reverse('datacenterlight:index') + '">Data Center Light</a>'
|
||||
reverse('datacenterlight:index') + '">Data Center Light</a>'
|
||||
message = '{sorry_message} <br />{go_back_to} {hurl}'.format(
|
||||
sorry_message=_("Sorry. Your request is invalid."),
|
||||
go_back_to=_('Go back to'),
|
||||
|
|
@ -342,6 +342,15 @@ class SSHKeyDeleteView(LoginRequiredMixin, DeleteView):
|
|||
success_url = reverse_lazy('hosting:ssh_keys')
|
||||
model = UserHostingKey
|
||||
|
||||
def get_object(self, queryset=None):
|
||||
""" Hook to ensure UserHostingKey object is owned by request.user.
|
||||
We reply with a Http404 if the user is not the owner of the key.
|
||||
"""
|
||||
obj = super(SSHKeyDeleteView, self).get_object()
|
||||
if not obj.user == self.request.user:
|
||||
raise Http404
|
||||
return obj
|
||||
|
||||
def delete(self, request, *args, **kwargs):
|
||||
owner = self.request.user
|
||||
manager = OpenNebulaManager()
|
||||
|
|
@ -547,8 +556,9 @@ class PaymentVMView(LoginRequiredMixin, FormView):
|
|||
customer = StripeCustomer.get_or_create(email=owner.email,
|
||||
token=token)
|
||||
if not customer:
|
||||
form.add_error("__all__", "Invalid credit card")
|
||||
return self.render_to_response(self.get_context_data(form=form))
|
||||
msg = _("Invalid credit card")
|
||||
messages.add_message(self.request, messages.ERROR, msg, extra_tags='make_charge_error')
|
||||
return HttpResponseRedirect(reverse('hosting:payment') + '#payment_error')
|
||||
|
||||
# Create Billing Address
|
||||
billing_address = form.save()
|
||||
|
|
@ -557,15 +567,12 @@ class PaymentVMView(LoginRequiredMixin, FormView):
|
|||
stripe_utils = StripeUtils()
|
||||
charge_response = stripe_utils.make_charge(amount=final_price,
|
||||
customer=customer.stripe_id)
|
||||
charge = charge_response.get('response_object')
|
||||
|
||||
# Check if the payment was approved
|
||||
if not charge:
|
||||
context.update({
|
||||
'paymentError': charge_response.get('error'),
|
||||
'form': form
|
||||
})
|
||||
return render(request, self.template_name, context)
|
||||
if not charge_response.get('response_object') and not charge_response.get('paid'):
|
||||
msg = charge_response.get('error')
|
||||
messages.add_message(self.request, messages.ERROR, msg, extra_tags='make_charge_error')
|
||||
return HttpResponseRedirect(reverse('hosting:payment') + '#payment_error')
|
||||
|
||||
charge = charge_response.get('response_object')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue