diff --git a/Changelog b/Changelog
index 74ba0160..1eaa55e5 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,7 @@
Next release:
* Bugfix: [dcl, hosting] Fix Stripe js error in confirm payment page
* #3847: [ungleich] change text 'hosting products' -> 'our products'
+ * #3829: [dcl] Handle landing login fail in payment page itself
1.2.6: 2017-10-10
* Bugfix: [dcl] Refactor and optimize images, links in glasfaser page
* Bugfix: [dcl] Fix email not being sent issue
diff --git a/datacenterlight/locale/de/LC_MESSAGES/django.po b/datacenterlight/locale/de/LC_MESSAGES/django.po
index d5035912..52d9623e 100644
--- a/datacenterlight/locale/de/LC_MESSAGES/django.po
+++ b/datacenterlight/locale/de/LC_MESSAGES/django.po
@@ -126,56 +126,42 @@ msgstr ""
msgid "Thank you!"
msgstr "Vielen Dank!"
-msgid "Account Activation"
-msgstr "Account Aktivierung"
+msgid "Data Center Light Account Activation"
+msgstr "Data Center Light Account Aktivierung"
#, python-format
msgid ""
-"\n"
-"You can activate your Data Center Light account by clicking here. \n"
+"You can activate your Data Center Light account by clicking here."
+msgstr ""
+"Klicke here um deinen Data Center "
+"Light Account zu aktivieren."
+
+msgid ""
"You can also copy and paste the following link into the address bar of your "
-"browser \n"
-"to activate your Data Center Light account. \n"
-"%(base_url)s%(activation_link)s\n"
-msgstr ""
-"\n"
-"Klicke hier um deinen Data "
-"Center Light Account zu aktivieren oder kopiere den folgenden Link in die "
-"Adressleiste deines Browsers. \n"
-"%(base_url)s%(activation_link)s\n"
+"browser to activate your Data Center Light account."
+msgstr "Kopiere den folgenden Link in die Adressleiste deines Browsers."
-#, python-format
msgid ""
-"Your account details are as follows:
\n"
-"Username : Your email address \n"
-"Password : %(account_details)s
\n"
-"You can reset your password here:\n"
-"%(base_url)s%(reset_password_url)s\n"
-msgstr ""
+"You can copy and paste the following link into the address bar of your "
+"browser to activate your Data Center Light account."
+msgstr "Kopiere den folgenden Link in die Adressleiste deines Browsers."
-#, python-format
-msgid ""
-"You can activate your Data Center Light account by clicking here.\n"
-"You can also copy and paste the following link into the address bar of your "
-"browser\n"
-"to activate your Data Center Light account.\n"
-"%(base_url)s%(activation_link)s\n"
-msgstr ""
-"Klicke hier, um deinen Data Center Light Account zu aktivieren oder kopiere "
-"den folgenden Link in die Adressleiste deines Browsers.\n"
-"%(base_url)s%(activation_link)s\n"
+msgid "Welcome to Data Center Light!"
+msgstr "Willkommen beim Data Center Light!"
-#, python-format
msgid ""
-"Your account details are as follows:\n"
-"\n"
-"Username : Your email address\n"
-"Password : %(account_details)s\n"
-"\n"
-"You can reset your password here:\n"
-"%(base_url)s%(reset_password_url)s\n"
-msgstr ""
+"Thanks for joining us! We provide the most affordable virtual machines from "
+"the heart of Switzerland."
+msgstr "Bei uns findest Du die günstiges VMs aus der Schweiz."
+
+msgid "Try now, order a VM. VM price starts from only 15CHF per month."
+msgstr "Unser Angebot beginnt bei 15 CHF pro Monat. Probier's jetzt aus!"
+
+msgid "ORDER VM"
+msgstr "VM BESTELLEN"
msgid "Home"
msgstr "Home"
@@ -512,6 +498,15 @@ msgstr ""
"Deine VM ist gleich bereit. Wir senden Dir eine Bestätigungsemail, sobald Du "
"auf sie zugreifen kannst."
+#~ msgid "Processing..."
+#~ msgstr "Abarbeitung..."
+
+#~ msgid "Hold tight, we are processing your request"
+#~ msgstr "Bitte warten - wir verbeiten Deine Anfrage gerade"
+
+#~ msgid "Some problem encountered. Please try again later."
+#~ msgstr "Ein Problem ist aufgetreten. Bitte versuche es später noch einmal."
+
#~ msgid "Submit"
#~ msgstr "Absenden"
@@ -530,15 +525,6 @@ msgstr ""
#~ msgid "Order summary"
#~ msgstr "Bestellungsübersicht"
-#~ msgid "Processing..."
-#~ msgstr "Abarbeitung..."
-
-#~ msgid "Hold tight, we are processing your request"
-#~ msgstr "Bitte warten - wir verbeiten Deine Anfrage gerade"
-
-#~ msgid "Some problem encountered. Please try again later."
-#~ msgstr "Ein Problem ist aufgetreten. Bitte versuche es später noch einmal."
-
#~ msgid "We are cutting down the costs significantly!"
#~ msgstr "Wir sorgen dafür, dass die Kosten für Dich signifikant abnehmen"
diff --git a/datacenterlight/static/datacenterlight/img/logo_black.png b/datacenterlight/static/datacenterlight/img/logo_black.png
new file mode 100644
index 00000000..5dfd0eaa
Binary files /dev/null and b/datacenterlight/static/datacenterlight/img/logo_black.png differ
diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py
index 1f34c3fe..3db6eb54 100644
--- a/datacenterlight/tasks.py
+++ b/datacenterlight/tasks.py
@@ -5,6 +5,7 @@ from celery.utils.log import get_task_logger
from celery import current_task
from django.conf import settings
from django.core.mail import EmailMessage
+from django.core.urlresolvers import reverse
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
@@ -131,9 +132,9 @@ def create_vm_task(self, vm_template_id, user, specs, template,
'storage': specs.get('disk_size'),
'price': specs.get('price'),
'template': template.get('name'),
- 'vm.name': vm['name'],
- 'vm.id': vm['vm_id'],
- 'order.id': order.id
+ 'vm_name': vm.get('name'),
+ 'vm_id': vm['vm_id'],
+ 'order_id': order.id
}
email_data = {
'subject': settings.DCL_TEXT + " Order from %s" % context['email'],
@@ -155,13 +156,14 @@ def create_vm_task(self, vm_template_id, user, specs, template,
translation.activate(lang)
# Send notification to the user as soon as VM has been booked
context = {
- 'vm': vm,
- 'order': order,
'base_url': "{0}://{1}".format(user.get('request_scheme'),
user.get('request_host')),
+ 'order_url': reverse('hosting:orders',
+ kwargs={'pk': order.id}),
'page_header': _(
'Your New VM %(vm_name)s at Data Center Light') % {
- 'vm_name': vm.get('name')}
+ 'vm_name': vm.get('name')},
+ 'vm_name': vm.get('name')
}
email_data = {
'subject': context.get('page_header'),
diff --git a/datacenterlight/templates/datacenterlight/emails/user_activation.html b/datacenterlight/templates/datacenterlight/emails/user_activation.html
index 3c7fae74..7008c1a1 100644
--- a/datacenterlight/templates/datacenterlight/emails/user_activation.html
+++ b/datacenterlight/templates/datacenterlight/emails/user_activation.html
@@ -1,24 +1,46 @@
-{% extends "datacenterlight/emails/base_email_datacenterlight.html" %}
-{% load static from staticfiles %}
-{% load i18n %}
-{% block email_head %}
-{{dcl_text}} {% trans 'Account Activation' %}
-{% endblock %}
-{% block email_body %}
-{% blocktrans %}
-You can activate your Data Center Light account by clicking here.
-You can also copy and paste the following link into the address bar of your browser
-to activate your Data Center Light account.
-{{base_url}}{{activation_link}}
-{% endblocktrans %}
-{% if account_details %}
-{% url 'hosting:reset_password' as reset_password_url %}
-
-{% blocktrans %}Your account details are as follows:
-Username : Your email address
-Password : {{account_details}}
+
+
+ {% trans "Data Center Light Account Activation" %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{% trans "Data Center Light Account Activation" %}
+
+
+
+
+
+ {% blocktrans %}You can activate your Data Center Light account by clicking here.{% endblocktrans %}
+
+
+ {% blocktrans %}You can also copy and paste the following link into the address bar of your browser to activate your Data Center Light account.{% endblocktrans %}
+
+
+ {{base_url}}{{activation_link}}
+
+
+
+
+
+
{% trans "Your Data Center Light Team" %}
+
+
+
+
+
+
diff --git a/datacenterlight/templates/datacenterlight/emails/user_activation.txt b/datacenterlight/templates/datacenterlight/emails/user_activation.txt
index 7c833256..13b3e7bf 100644
--- a/datacenterlight/templates/datacenterlight/emails/user_activation.txt
+++ b/datacenterlight/templates/datacenterlight/emails/user_activation.txt
@@ -1,21 +1,9 @@
-{% extends "datacenterlight/emails/base_email_datacenterlight.txt" %}
{% load i18n %}
-{% block email_head %}{{dcl_text}} {% trans 'Account Activation' %}{% endblock %}
-{% block email_body %}
-{% blocktrans %}You can activate your Data Center Light account by clicking here.
-You can also copy and paste the following link into the address bar of your browser
-to activate your Data Center Light account.
+
+{% trans "Data Center Light Account Activation" %}
+
+{% blocktrans %}You can copy and paste the following link into the address bar of your browser to activate your Data Center Light account.{% endblocktrans %}
+
{{base_url}}{{activation_link}}
-{% endblocktrans %}
-{% if account_details %}
-{% url 'hosting:reset_password' as reset_password_url %}
-{% blocktrans %}Your account details are as follows:
-Username : Your email address
-Password : {{account_details}}
-
-You can reset your password here:
-{{base_url}}{{reset_password_url}}
-{% endblocktrans %}
-{% endif %}
-{% endblock %}
+{% trans "Your Data Center Light Team" %}
\ No newline at end of file
diff --git a/datacenterlight/templates/datacenterlight/emails/welcome_user.html b/datacenterlight/templates/datacenterlight/emails/welcome_user.html
new file mode 100644
index 00000000..e947ac97
--- /dev/null
+++ b/datacenterlight/templates/datacenterlight/emails/welcome_user.html
@@ -0,0 +1,48 @@
+{% load static i18n %}
+
+
+
+
+
+
+ {% trans "Welcome to Data Center Light!" %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{% trans "Welcome to Data Center Light!" %}
+
+
+
+
+
+ {% blocktrans %}Thanks for joining us! We provide the most affordable virtual machines from the heart of Switzerland.{% endblocktrans %}
+
+
+ {% blocktrans %}Try now, order a VM. VM price starts from only 15CHF per month.{% endblocktrans %}
+
+
+
+
\ No newline at end of file
diff --git a/datacenterlight/templates/datacenterlight/emails/welcome_user.txt b/datacenterlight/templates/datacenterlight/emails/welcome_user.txt
new file mode 100644
index 00000000..0e7820e6
--- /dev/null
+++ b/datacenterlight/templates/datacenterlight/emails/welcome_user.txt
@@ -0,0 +1,10 @@
+{% load i18n %}
+
+{% trans "Welcome to Data Center Light!" %}
+
+{% blocktrans %}Thanks for joining us! We provide the most affordable virtual machines from the heart of Switzerland.{% endblocktrans %}
+{% blocktrans %}Try now, order a VM. VM price starts from only 15CHF per month.{% endblocktrans %}
+
+{{ base_url }}{% url 'hosting:create_virtual_machine' %}
+
+{% trans "Your Data Center Light Team" %}
\ No newline at end of file
diff --git a/datacenterlight/templates/datacenterlight/landing_payment.html b/datacenterlight/templates/datacenterlight/landing_payment.html
index fa638d77..d195690b 100644
--- a/datacenterlight/templates/datacenterlight/landing_payment.html
+++ b/datacenterlight/templates/datacenterlight/landing_payment.html
@@ -25,14 +25,15 @@
{%trans "Log in" %}
{% blocktrans %}Already signed up? By logging in you can retrieve saved billing information.{% endblocktrans %}
-
@@ -58,7 +59,7 @@
{% endfor %}
@@ -153,22 +154,12 @@
{% endif %}
{% for message in messages %}
- {% if 'failed_payment' in message.tags or 'make_charge_error' in message.tags %}
+ {% if 'failed_payment' in message.tags or 'make_charge_error' in message.tags or 'error' in message.tags %}
{{ message|safe }}
- {% elif not form.non_field_errors %}
-
- {% trans "You are not making any payment yet. After placing your order, you will be taken to the Submit Payment Page." %}
-
{% endif %}
{% endfor %}
-
- {% for error in form.non_field_errors %}
-
- {{ error|escape }}
-
- {% endfor %}
diff --git a/datacenterlight/views.py b/datacenterlight/views.py
index 81c83685..bd1a7f51 100644
--- a/datacenterlight/views.py
+++ b/datacenterlight/views.py
@@ -345,26 +345,45 @@ class PaymentOrderView(FormView):
else:
return BillingAddressFormSignup
- def get_form_kwargs(self):
- form_kwargs = super(PaymentOrderView, self).get_form_kwargs()
- # if user is signed in, get billing address
- if self.request.user.is_authenticated():
- form_kwargs.update({
- 'instance': self.request.user.billing_addresses.first()
- })
- if 'billing_address_data' in self.request.session:
- billing_address_data = self.request.session['billing_address_data']
- form_kwargs.update({
- 'initial': billing_address_data
- })
- return form_kwargs
-
def get_context_data(self, **kwargs):
context = super(PaymentOrderView, self).get_context_data(**kwargs)
+ if 'billing_address_data' in self.request.session:
+ billing_address_data = self.request.session['billing_address_data']
+ else:
+ billing_address_data = {}
+
+ if self.request.user.is_authenticated():
+ if billing_address_data:
+ billing_address_form = BillingAddressForm(
+ initial=billing_address_data
+ )
+ else:
+ billing_address_form = BillingAddressForm(
+ instance=self.request.user.billing_addresses.first()
+ )
+ # Get user last order
+ last_hosting_order = HostingOrder.objects.filter(
+ customer__user=self.request.user
+ ).last()
+
+ # If user has already an hosting order, get the credit card
+ # data from it
+ if last_hosting_order:
+ credit_card_data = last_hosting_order.get_cc_data()
+ if credit_card_data:
+ context['credit_card_data'] = credit_card_data
+ else:
+ context['credit_card_data'] = None
+ else:
+ billing_address_form = BillingAddressFormSignup(
+ initial=billing_address_data
+ )
+
context.update({
'stripe_key': settings.STRIPE_API_PUBLIC_KEY,
'site_url': reverse('datacenterlight:index'),
- 'login_form': HostingUserLoginForm()
+ 'login_form': HostingUserLoginForm(prefix='login_form'),
+ 'billing_address_form': billing_address_form
})
return context
@@ -376,9 +395,32 @@ class PaymentOrderView(FormView):
return self.render_to_response(self.get_context_data())
def post(self, request, *args, **kwargs):
- form = self.get_form()
- if form.is_valid():
- token = form.cleaned_data.get('token')
+ if 'login_form' in request.POST:
+ login_form = HostingUserLoginForm(data=request.POST,
+ prefix='login_form')
+ if login_form.is_valid():
+ email = login_form.cleaned_data.get('email')
+ password = login_form.cleaned_data.get('password')
+ auth_user = authenticate(email=email, password=password)
+ if auth_user:
+ login(self.request, auth_user)
+ return HttpResponseRedirect(
+ reverse('datacenterlight:payment')
+ )
+ else:
+ context = self.get_context_data()
+ context['login_form'] = login_form
+ return self.render_to_response(context)
+ if request.user.is_authenticated():
+ address_form = BillingAddressForm(
+ data=request.POST,
+ )
+ else:
+ address_form = BillingAddressFormSignup(
+ data=request.POST,
+ )
+ if address_form.is_valid():
+ token = address_form.cleaned_data.get('token')
if request.user.is_authenticated():
this_user = {
'email': request.user.email,
@@ -388,8 +430,8 @@ class PaymentOrderView(FormView):
email=this_user.get('email'),
token=token)
else:
- user_email = form.cleaned_data.get('email')
- user_name = form.cleaned_data.get('name')
+ user_email = address_form.cleaned_data.get('email')
+ user_name = address_form.cleaned_data.get('name')
this_user = {
'email': user_email,
'name': user_name
@@ -422,13 +464,18 @@ class PaymentOrderView(FormView):
token=token,
customer_name=user_name)
- request.session['billing_address_data'] = form.cleaned_data
+ request.session['billing_address_data'] = address_form.cleaned_data
request.session['user'] = this_user
# Get or create stripe customer
if not customer:
- form.add_error("__all__", "Invalid credit card")
+ address_form.add_error(
+ "__all__", "Invalid credit card"
+ )
return self.render_to_response(
- self.get_context_data(form=form))
+ self.get_context_data(
+ billing_address_form=address_form
+ )
+ )
request.session['token'] = token
if type(customer) is StripeCustomer:
request.session['customer'] = customer.stripe_id
@@ -437,7 +484,9 @@ class PaymentOrderView(FormView):
return HttpResponseRedirect(
reverse('datacenterlight:order_confirmation'))
else:
- return self.form_invalid(form)
+ context = self.get_context_data()
+ context['billing_address_form'] = address_form
+ return self.render_to_response(context)
class OrderConfirmationView(DetailView):
@@ -548,9 +597,13 @@ class OrderConfirmationView(DetailView):
try:
custom_user = CustomUser.objects.get(
email=user.get('email'))
- customer = StripeCustomer.objects.filter(
+ stripe_customer = StripeCustomer.objects.filter(
user_id=custom_user.id).first()
- stripe_customer_id = customer.id
+ if stripe_customer is None:
+ stripe_customer = StripeCustomer.objects.create(
+ user=custom_user, stripe_id=stripe_api_cus_id
+ )
+ stripe_customer_id = stripe_customer.id
except CustomUser.DoesNotExist:
logger.debug(
"Customer {} does not exist.".format(user.get('email')))
diff --git a/hosting/forms.py b/hosting/forms.py
index 056d0004..7be7a588 100644
--- a/hosting/forms.py
+++ b/hosting/forms.py
@@ -29,6 +29,8 @@ class HostingUserLoginForm(forms.Form):
def clean(self):
email = self.cleaned_data.get('email')
password = self.cleaned_data.get('password')
+ if self.errors:
+ return self.cleaned_data
is_auth = authenticate(email=email, password=password)
if not is_auth:
raise forms.ValidationError(
diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po
index caee133b..60090cb6 100644
--- a/hosting/locale/de/LC_MESSAGES/django.po
+++ b/hosting/locale/de/LC_MESSAGES/django.po
@@ -192,101 +192,78 @@ msgid "Support / Contact"
msgstr "Support / Kontakt"
#, python-format
-msgid ""
-"You have ordered a new virtual machine!\n"
-" \n"
-"Your order of [%(vm_name)s] has been charged.
\n"
-"You can view your invoice by clicking the button below.
\n"
-msgstr ""
-"Du hast eine neue virtuelle Maschine bestellt! \n"
-"Deine Bestellung von [%(vm_name)s] wurde erhoben.
\n"
-"Um die Rechnung zu sehen, klicke auf den Button unten.
\n"
+msgid "Your New VM %(vm_name)s"
+msgstr "Deine Neue VM %(vm_name)s"
-msgid "View Invoice"
-msgstr "Zur Rechnung"
+msgid "You have ordered a new virtual machine!"
+msgstr "Du hast eine neue virtuelle Maschine bestellt!"
#, python-format
-msgid ""
-"You have ordered a new virtual machine!\n"
-"Your order of [%(vm_name)s] has been charged.\n"
-"You can view your invoice here.\n"
-msgstr ""
-"Du hast eine neue virtuelle Maschine bestellt!\n"
-"Deine Bestellung von [%(vm_name)s] wurde erhoben.\n"
-"Um die Rechnung zu sehen, klicke hier.\n"
+msgid "Your order of [ %(vm_name)s ] has been charged."
+msgstr "Deine Bestellung von [ %(vm_name)s ] wurde erhoben."
+
+msgid "You can view your VM detail by clicking the button below."
+msgstr "Um die Rechnung zu sehen, klicke auf den Button unten."
+
+msgid "View Detail"
+msgstr "Details anzeigen"
+
+msgid "Your Data Center Light Team"
+msgstr "Dein Data Center Light Team"
+
+#, python-format
+msgid "Your order of [%(vm_name)s] has been charged."
+msgstr "Deine Bestellung von [%(vm_name)s] wurde erhoben."
+
+msgid "You can view your VM detail by following the link below."
+msgstr "Um die Rechnung zu sehen, klicke auf den Link unten."
msgid "Password Reset"
msgstr "Passwort zurücksetzen"
-#, python-format
-msgid ""
-"\n"
-"You're receiving this email because you requested a password reset for your "
-"user account at %(site_name)s. \n"
-"Please go to the following page and choose a new password: %(base_url)s"
-"%(password_reset_url)s \n"
-"If you didn't request a new password, ignore this e-mail. \n"
-"Thank you!\n"
+msgid "We received a request to reset your password."
+msgstr "Wir haben eine Anfrage erhalten, um Dein Passwort zurückzusetzen."
+
+msgid "If you didn't make this request you can safely ignore this email."
msgstr ""
-"\n"
-"Du erhälst diese E-Mail da Du Dein Passwort für Deinen Account bei "
-"%(site_name)s zurücksetzen möchtest. \n"
-"Bitte folge diesem Link und wähle ein neues Passwort: %(base_url)s"
-"%(password_reset_url)s Solltest Du kein neues Passwort angefordert haben, "
-"dann ignoriere diese E-Mail. \n"
-"Dankeschön!\n"
+"Falls Du kein neues Passwort angefragt hast, kannst Du diese E-mail "
+"ignorieren."
+
+msgid "Otherwise, click here to reset your password."
+msgstr "Andernfalls klicke hier, um Dein Passwort zurückzusetzen."
+
+msgid "Thank you!"
+msgstr "Dankeschön!"
+
+msgid "Virtual Machine Cancellation"
+msgstr "VM Kündigung"
#, python-format
msgid ""
-"You're receiving this email because you requested a password reset for your "
-"user account at %(site_name)s.\n"
-"Please go to the following page and choose a new password: %(base_url)s"
-"%(password_reset_url)s\n"
-"If you didn't request a new password, ignore this e-mail.\n"
-"Thank you!\n"
+"You are receiving this email because your virutal machine [ "
+"%(vm_name)s ] has been cancelled."
msgstr ""
-"Du erhälst diese E-Mail da Du Dein Passwort für Deinen Account bei "
-"%(site_name)s zurücksetzen möchtest.\n"
-"Bitte folge diesem Link und wähle ein neues Passwort: %(base_url)s"
-"%(password_reset_url)s Solltest Du kein neues Passwort angefordert haben, "
-"dann ignoriere diese E-Mail.\n"
-"Dankeschön!\n"
+"Du erhälst diese E-Mail, da deine virtuelle Maschine [ %(vm_name)s"
+"strong> ] gekündigt wurde."
+
+msgid "You can always order a new VM by clicking the button below."
+msgstr ""
+"Du kannst einfach eine neue VM bestellen, indem Du den Knopf weiter unten "
+"drückst."
+
+msgid "CREATE VM"
+msgstr "NEUE VM"
#, python-format
msgid ""
-"You're receiving this mail because your virtual machine [%(vm_name)s] has "
-"been cancelled. \n"
-"You can see your order status by clicking [my VM page] below. \n"
-"If you want to order a new virtual machine, you can do it by clicking this link. \n"
+"You are receiving this email because your virutal machine [%(vm_name)s] has "
+"been cancelled."
msgstr ""
-"Du erhälst diese E-Mail, Da Deine virtuelle Maschine [%(vm_name)s] gekündigt "
-"wurde. \n"
-"Um Deinen Auftragsstatus zu sehen, klicke auf die [my VM page] unten. \n"
-"Falls Du eine neue virtuelle Maschine bestellen möchtest, kannst Du dies "
-"tun, indem Du diesen "
-"Link klickst. \n"
+"Du erhälst diese E-Mail, da deine virtuelle Maschine [%(vm_name)s] gekündigt "
+"wurde."
-msgid "My VM page"
-msgstr "Meine VM page"
-
-#, python-format
-msgid ""
-"You're receiving this mail because your virtual machine [%(vm_name)s] has "
-"been cancelled.\n"
-"You can see your order status by clicking here\n"
-"%(base_url)s%(vm_order_url)s\n"
-"If you want to order a new virtual machine, you can do it by clicking this "
-"link.\n"
-"%(base_url)s%(my_virtual_machines_url)s\n"
+msgid "You can always order a new VM by following the link below."
msgstr ""
-"Du erhälst diese E-Mail, da Deine virtuelle Maschine [%(vm_name)s] gekündigt "
-"wurde.\n"
-"Um Deinen Auftragsstatus zu sehen, klicke hier.\n"
-"%(base_url)s%(vm_order_url)s\n"
-"Falls Du eine neue virtuelle Maschine bestellen möchtest, kannst Du dies "
-"tun, indem Du diesen Link klickst.\n"
-"%(base_url)s%(my_virtual_machines_url)s\n"
msgid "Toggle navigation"
msgstr "Umschalten"
@@ -630,12 +607,6 @@ msgstr ""
"Um auf Deine VM zuzugreifen, füge Deinen SSH-"
"Key hinzu"
-msgid "CREATE VM"
-msgstr "NEUE VM"
-
-msgid "View Detail"
-msgstr "Details anzeigen"
-
msgid "login"
msgstr "anmelden"
@@ -660,6 +631,9 @@ msgstr "Dein Account wurde aktiviert."
msgid "You can now"
msgstr "Du kannst dich nun"
+msgid "Welcome to Data Center Light!"
+msgstr "Willkommen beim Data Center Light!"
+
msgid "Sorry. Your request is invalid."
msgstr "Entschuldigung, deine Anfrage ist ungültig."
@@ -730,8 +704,9 @@ msgstr ""
msgid "Error terminating VM"
msgstr "Fehler beenden VM"
-msgid "Virtual Machine Cancellation"
-msgstr "VM Kündigung"
+#, python-format
+msgid "Virtual Machine %(vm_name)s Cancelled"
+msgstr "Virtuelle Maschine %(vm_name)s Kündigung"
msgid "There was an error processing your request. Please try again."
msgstr ""
@@ -741,6 +716,9 @@ msgstr ""
#~ msgid "Reset your password"
#~ msgstr "Passwort zurücksetzen"
+#~ msgid "My VM page"
+#~ msgstr "Meine VM page"
+
#~ msgid "Invoice Date"
#~ msgstr "Rechnung Datum"
@@ -768,12 +746,27 @@ msgstr ""
#~ msgid "Start VM"
#~ msgstr "VM jetzt starten"
+#~ msgid "View Invoice"
+#~ msgstr "Zur Rechnung"
+
+#~ msgid ""
+#~ "You're receiving this mail because your virtual machine [%(vm_name)s] has "
+#~ "been cancelled. \n"
+#~ "You can see your order status by clicking [my VM page] below. \n"
+#~ "If you want to order a new virtual machine, you can do it by clicking this link. \n"
+#~ msgstr ""
+#~ "Du erhälst diese E-Mail, da deine virtuelle Maschine [%(vm_name)s] "
+#~ "gekündigt wurde. \n"
+#~ "Um deinen Auftragsstatus zu sehen, klicke auf die [my VM page] unten. \n"
+#~ "Falls du eine neue virtuelle Maschine bestellen möchtest, kannst du dies "
+#~ "tun, indem du diesen "
+#~ "Link klickst. \n"
+
#~ msgid "Finish Configuration"
#~ msgstr "Konfiguration beenden"
-#~ msgid "Your New VM %(vm_name)s at Data Center Light"
-#~ msgstr "Deine neue VM %(vm_name)s bei Data Center Light"
-
#~ msgid "My Virtual Machines"
#~ msgstr "Meine virtuellen Maschinen"
diff --git a/hosting/models.py b/hosting/models.py
index 49932f69..04f3ae30 100644
--- a/hosting/models.py
+++ b/hosting/models.py
@@ -1,7 +1,9 @@
import os
import logging
+from dateutil.relativedelta import relativedelta
from django.db import models
+from django.utils import timezone
from django.utils.functional import cached_property
from Crypto.PublicKey import RSA
from membership.models import StripeCustomer, CustomUser
@@ -172,3 +174,9 @@ class VMDetail(models.Model):
ipv6 = models.TextField(default='')
created_at = models.DateTimeField(auto_now_add=True)
terminated_at = models.DateTimeField(null=True)
+
+ def end_date(self):
+ end_date = self.terminated_at if self.terminated_at else timezone.now()
+ months = relativedelta(end_date, self.created_at).months or 1
+ end_date = self.created_at + relativedelta(months=months, days=-1)
+ return end_date
diff --git a/hosting/static/hosting/css/commons.css b/hosting/static/hosting/css/commons.css
index 2fb9a94e..74896a4b 100644
--- a/hosting/static/hosting/css/commons.css
+++ b/hosting/static/hosting/css/commons.css
@@ -373,4 +373,12 @@
outline: none;
color: #999;
fill: #999;
+}
+
+.locale_date {
+ opacity: 0;
+}
+
+.locale_date.done{
+ opacity: 1;
}
\ No newline at end of file
diff --git a/hosting/templates/hosting/emails/new_booked_vm.html b/hosting/templates/hosting/emails/new_booked_vm.html
index 864cf813..b80aebe0 100644
--- a/hosting/templates/hosting/emails/new_booked_vm.html
+++ b/hosting/templates/hosting/emails/new_booked_vm.html
@@ -1,14 +1,51 @@
-{% extends "datacenterlight/emails/base_email_datacenterlight.html" %}
-{% load i18n %}
-{% block email_head %}{{page_header}}{% endblock %}
-{% block email_body %}
-{% url 'hosting:orders' order.id as order_url %}
-{% blocktrans with vm.name as vm_name %}You have ordered a new virtual machine!
-
-Your order of [{{vm_name}}] has been charged.
-You can view your invoice by clicking the button below.
+
+
+
\ No newline at end of file
diff --git a/hosting/templates/hosting/emails/new_booked_vm.txt b/hosting/templates/hosting/emails/new_booked_vm.txt
index b8e3eed1..cfd9c63a 100644
--- a/hosting/templates/hosting/emails/new_booked_vm.txt
+++ b/hosting/templates/hosting/emails/new_booked_vm.txt
@@ -1,11 +1,11 @@
-{% extends "datacenterlight/emails/base_email_datacenterlight.txt" %}
{% load i18n %}
-{% block email_head %}{{page_header}}{% endblock %}
-{% block email_body %}
-{% url 'hosting:orders' order.id as order_url %}
-{% blocktrans with vm.name as vm_name %}You have ordered a new virtual machine!
-Your order of [{{vm_name}}] has been charged.
-You can view your invoice here.
-{% endblocktrans %}
-{{ base_url }}{{order_url}}
-{% endblock %}
+
+{% blocktrans %}Your New VM {{vm_name}}{% endblocktrans %}
+
+{% blocktrans %}You have ordered a new virtual machine!{% endblocktrans %}
+{% blocktrans %}Your order of {{vm_name}} has been charged.{% endblocktrans %}
+{% blocktrans %}You can view your VM detail by following the link below.{% endblocktrans %}
+
+{{ base_url }}{{ order_url }}
+
+{% trans "Your Data Center Light Team" %}
\ No newline at end of file
diff --git a/hosting/templates/hosting/emails/password_reset_email.html b/hosting/templates/hosting/emails/password_reset_email.html
index b83a08f2..57831228 100644
--- a/hosting/templates/hosting/emails/password_reset_email.html
+++ b/hosting/templates/hosting/emails/password_reset_email.html
@@ -1,14 +1,52 @@
-{% extends "datacenterlight/emails/base_email_datacenterlight.html" %}
-{% load i18n %}
-{% block email_head %}
-{% trans 'Password Reset' %}
-{% endblock %}
-{% block email_body %}
-{% url 'hosting:reset_password_confirm' uidb64=uid token=token as password_reset_url %}
-{% blocktrans %}
-You're receiving this email because you requested a password reset for your user account at {{site_name}}.
-Please go to the following page and choose a new password: {{base_url}}{{ password_reset_url }}
-If you didn't request a new password, ignore this e-mail.
-Thank you!
-{% endblocktrans %}
-{% endblock %}
+{% load static i18n %}
+
+
+
+
+
+
+ {% trans "Password Reset" %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{% trans "Password Reset" %}
+
+
+
+
+
+ {% trans "We received a request to reset your password." %}
+
+
+ {% trans "If you didn't make this request you can safely ignore this email." %}
+
+ {% trans "Otherwise, click here to reset your password." %}
+
+
+
+
\ No newline at end of file
diff --git a/hosting/templates/hosting/emails/password_reset_email.txt b/hosting/templates/hosting/emails/password_reset_email.txt
index 769166ed..f2ada3b2 100644
--- a/hosting/templates/hosting/emails/password_reset_email.txt
+++ b/hosting/templates/hosting/emails/password_reset_email.txt
@@ -1,11 +1,14 @@
-{% extends "datacenterlight/emails/base_email_datacenterlight.txt" %}
{% load i18n %}
-{% block email_head %}{% trans 'Password Reset' %}{% endblock %}
-{% block email_body %}
+
+{% trans "Password Reset" %}
+
+{% trans "We received a request to reset your password." %}
+{% trans "If you didn't make this request you can safely ignore this email." %}
+{% trans "Otherwise, click here to reset your password." %}
+
{% url 'hosting:reset_password_confirm' uidb64=uid token=token as password_reset_url %}
-{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{site_name}}.
-Please go to the following page and choose a new password: {{base_url}}{{ password_reset_url }}
-If you didn't request a new password, ignore this e-mail.
-Thank you!
-{% endblocktrans %}
-{% endblock %}
+{{base_url}}{{ password_reset_url }}
+
+{% trans "Thank you!" %}
+
+{% trans "Your Data Center Light Team" %}
diff --git a/hosting/templates/hosting/emails/vm_canceled.html b/hosting/templates/hosting/emails/vm_canceled.html
index 68c7b9fd..3142f6bc 100644
--- a/hosting/templates/hosting/emails/vm_canceled.html
+++ b/hosting/templates/hosting/emails/vm_canceled.html
@@ -1,15 +1,49 @@
-{% extends "datacenterlight/emails/base_email_datacenterlight.html" %}
-{% load i18n %}
-{% block email_head %}{{page_header}}{% endblock %}
-{% block email_body %}
-{% url 'hosting:virtual_machines' as my_virtual_machines_url %}
-{% url 'hosting:orders' as vm_orders_url %}
-{% blocktrans with vm.name as vm_name %}You're receiving this mail because your virtual machine [{{vm_name}}] has been cancelled.
-You can see your order status by clicking [my VM page] below.
-If you want to order a new virtual machine, you can do it by clicking this link.
-{% endblocktrans %}
-
+
+
+
diff --git a/hosting/templates/hosting/emails/vm_canceled.txt b/hosting/templates/hosting/emails/vm_canceled.txt
index e20e639c..9149a554 100644
--- a/hosting/templates/hosting/emails/vm_canceled.txt
+++ b/hosting/templates/hosting/emails/vm_canceled.txt
@@ -1,13 +1,10 @@
-{% extends "datacenterlight/emails/base_email_datacenterlight.txt" %}
{% load i18n %}
-{% block email_head %}{{page_header}}{% endblock %}
-{% block email_body %}
-{% url 'hosting:virtual_machines' as my_virtual_machines_url %}
-{% url 'hosting:orders' order.id as vm_order_url %}
-{% blocktrans with vm.name as vm_name %}You're receiving this mail because your virtual machine [{{vm_name}}] has been cancelled.
-You can see your order status by clicking here
-{{base_url}}{{vm_order_url}}
-If you want to order a new virtual machine, you can do it by clicking this link.
-{{base_url}}{{my_virtual_machines_url}}
-{% endblocktrans %}
-{% endblock %}
\ No newline at end of file
+
+{% trans "Virtual Machine Cancellation" %}
+
+{% blocktrans %}You are receiving this email because your virutal machine {{vm_name}} has been cancelled.{% endblocktrans %}
+{% blocktrans %}You can always order a new VM by following the link below.{% endblocktrans %}
+
+{{ base_url }}{% url 'hosting:create_virtual_machine' %}
+
+{% trans "Your Data Center Light Team" %}
\ No newline at end of file
diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html
index c81a893f..fe200f6e 100644
--- a/hosting/templates/hosting/order_detail.html
+++ b/hosting/templates/hosting/order_detail.html
@@ -32,11 +32,11 @@
{% endif %}
{% trans "Date" %}:
-
+
{% if order %}
- {{order.created_at|date:'Y-m-d H:i'}}
+ {{order.created_at|date:'Y-m-d h:i a'}}
{% else %}
- {% now "Y-m-d H:i" %}
+ {% now "Y-m-d h:i a" %}
{% endif %}
@@ -107,7 +107,9 @@
{% if vm.created_at %}
{% trans "Period" %}:
- {{ vm.created_at|date:'Y/m/d' }} - {% if vm.terminated_at %}{{ vm.terminated_at|date:'Y/m/d' }}{% else %}{% now 'Y/m/d' %}{% endif %}
+
+ {{ vm.created_at|date:'Y-m-d h:i a' }} - {{ subscription_end_date|date:'Y-m-d h:i a' }}
+