From 0e72f8a4367c8ada9c81513b1b36b24469ed19dd Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Sun, 20 Aug 2017 03:30:10 +0530 Subject: [PATCH 0001/1159] downtime page --- .../datacenterlight/css/downtime-page.css | 52 +++++++++++++++ .../templates/datacenterlight/downtime.html | 63 +++++++++++++++++++ datacenterlight/urls.py | 11 +++- 3 files changed, 123 insertions(+), 3 deletions(-) create mode 100644 datacenterlight/static/datacenterlight/css/downtime-page.css create mode 100644 datacenterlight/templates/datacenterlight/downtime.html diff --git a/datacenterlight/static/datacenterlight/css/downtime-page.css b/datacenterlight/static/datacenterlight/css/downtime-page.css new file mode 100644 index 00000000..9bbfa5bc --- /dev/null +++ b/datacenterlight/static/datacenterlight/css/downtime-page.css @@ -0,0 +1,52 @@ +body { + font-family: Lato, sans-serif; + font-weight: 300; + font-size: 20px; + line-height: 1; +} + +h1 { + font-weight: 300; + font-size: 52px; + text-align: center; +} + +nav { + padding: 15px; +} + +.downtime-container { + max-width: 1200px; + margin: auto; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.downtime-msg { + text-align: center; + font-size: 30px; +} + +.downtime-contact { + max-width: 300px; + margin: auto; + color: #4a90e2; +} + +h2 { + font-weight: 300; + font-size: 24px; + text-align: center; +} +p { + margin: 15px auto +} +.xl_p { + margin: 15px auto; +} + +a { + color: #4a90e2; + text-decoration: none; +} \ No newline at end of file diff --git a/datacenterlight/templates/datacenterlight/downtime.html b/datacenterlight/templates/datacenterlight/downtime.html new file mode 100644 index 00000000..dd5954ca --- /dev/null +++ b/datacenterlight/templates/datacenterlight/downtime.html @@ -0,0 +1,63 @@ +{% load staticfiles bootstrap3%} +{% load i18n %} + + + + + + + + + + + + ungleich + + + + + + + + + + + + + + {% include "google_analytics.html" %} + + + + + +
+ + +

{% trans "You caught us while working!" %}

+
+

{% trans "We're doing scheduled maintainence from" %}

+

17:00 21.08.2017 {% trans "to" %} 23:00 21.08.2017 CEST.

+
+

{% trans "If you need immediate assistance, please contact us at" %}

+ +
+ + + diff --git a/datacenterlight/urls.py b/datacenterlight/urls.py index a3aed7a6..a0942695 100644 --- a/datacenterlight/urls.py +++ b/datacenterlight/urls.py @@ -1,17 +1,22 @@ from django.conf.urls import url +from django.views.generic import TemplateView from .views import IndexView, BetaProgramView, LandingProgramView, BetaAccessView, PricingView, SuccessView, \ - PaymentOrderView, OrderConfirmationView, WhyDataCenterLightView + PaymentOrderView, OrderConfirmationView, WhyDataCenterLightView urlpatterns = [ url(r'^$', IndexView.as_view(), name='index'), - url(r'^whydatacenterlight/?$', WhyDataCenterLightView.as_view(), name='whydatacenterlight'), + url(r'^whydatacenterlight/?$', WhyDataCenterLightView.as_view(), + name='whydatacenterlight'), url(r'^beta-program/?$', BetaProgramView.as_view(), name='beta'), url(r'^landing/?$', LandingProgramView.as_view(), name='landing'), url(r'^pricing/?$', PricingView.as_view(), name='pricing'), url(r'^payment/?$', PaymentOrderView.as_view(), name='payment'), - url(r'^order-confirmation/?$', OrderConfirmationView.as_view(), name='order_confirmation'), + url(r'^order-confirmation/?$', OrderConfirmationView.as_view(), + name='order_confirmation'), url(r'^order-success/?$', SuccessView.as_view(), name='order_success'), url(r'^beta_access?$', BetaAccessView.as_view(), name='beta_access'), + + url(r'test/?$', TemplateView.as_view(template_name='datacenterlight/downtime.html')), ] From 06c68873aea768ba04419a36aac3ae123fd08713 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Sun, 20 Aug 2017 03:59:24 +0530 Subject: [PATCH 0002/1159] downtime.html modified as a static html page --- .../datacenterlight/css/downtime-page.css | 52 ----------- .../templates/datacenterlight/downtime.html | 86 ++++++++++++++----- 2 files changed, 64 insertions(+), 74 deletions(-) delete mode 100644 datacenterlight/static/datacenterlight/css/downtime-page.css diff --git a/datacenterlight/static/datacenterlight/css/downtime-page.css b/datacenterlight/static/datacenterlight/css/downtime-page.css deleted file mode 100644 index 9bbfa5bc..00000000 --- a/datacenterlight/static/datacenterlight/css/downtime-page.css +++ /dev/null @@ -1,52 +0,0 @@ -body { - font-family: Lato, sans-serif; - font-weight: 300; - font-size: 20px; - line-height: 1; -} - -h1 { - font-weight: 300; - font-size: 52px; - text-align: center; -} - -nav { - padding: 15px; -} - -.downtime-container { - max-width: 1200px; - margin: auto; - display: flex; - flex-direction: column; - justify-content: space-between; -} - -.downtime-msg { - text-align: center; - font-size: 30px; -} - -.downtime-contact { - max-width: 300px; - margin: auto; - color: #4a90e2; -} - -h2 { - font-weight: 300; - font-size: 24px; - text-align: center; -} -p { - margin: 15px auto -} -.xl_p { - margin: 15px auto; -} - -a { - color: #4a90e2; - text-decoration: none; -} \ No newline at end of file diff --git a/datacenterlight/templates/datacenterlight/downtime.html b/datacenterlight/templates/datacenterlight/downtime.html index dd5954ca..17c40d79 100644 --- a/datacenterlight/templates/datacenterlight/downtime.html +++ b/datacenterlight/templates/datacenterlight/downtime.html @@ -1,5 +1,3 @@ -{% load staticfiles bootstrap3%} -{% load i18n %} @@ -13,23 +11,69 @@ ungleich - - + @@ -37,25 +81,23 @@
-

{% trans "You caught us while working!" %}

+

You caught us while working!

-

{% trans "We're doing scheduled maintainence from" %}

-

17:00 21.08.2017 {% trans "to" %} 23:00 21.08.2017 CEST.

+

We're doing scheduled maintenance from

+

17:00 21.08.2017 to 23:00 21.08.2017 CEST.

-

{% trans "If you need immediate assistance, please contact us at" %}

+

If you need immediate assistance, please contact us at

From 6536991209fc25af113a91dfa93988ede3a00952 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Fri, 6 Oct 2017 01:17:35 +0530 Subject: [PATCH 0003/1159] list all cards, card_input template --- .../datacenterlight/landing_payment.html | 58 +-------------- hosting/templates/hosting/payment.html | 57 +------------- hosting/templates/hosting/settings.html | 74 +++---------------- hosting/views.py | 19 +++-- 4 files changed, 20 insertions(+), 188 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/landing_payment.html b/datacenterlight/templates/datacenterlight/landing_payment.html index fa638d77..1a476797 100644 --- a/datacenterlight/templates/datacenterlight/landing_payment.html +++ b/datacenterlight/templates/datacenterlight/landing_payment.html @@ -121,63 +121,7 @@ {% else %} -
- -
-
-
- -
-
-
-
- -
-
-
- -
-
-
-
- - -
-
-
-
- {% if not messages and 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 %} -
- {% for message in messages %} - {% if 'failed_payment' in message.tags or 'make_charge_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 %} -
-
- -
- -
-

-
-
+ {% include "hosting/includes/_card_input.html" %} {% endif %} diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index e9d6476f..a10cfbca 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -105,62 +105,7 @@ {% else %} -
- -
-
-
- -
-
-
-
- -
-
-
- -
-
-
-
- - -
-
-
-
- {% if not messages and not form.non_field_errors %} -

- {% trans "You are not making any payment yet. After submitting your card information, you will be taken to the Confirm Order Page." %} -

- {% endif %} -
- {% for message in messages %} - {% if 'failed_payment' or 'make_charge_error' in message.tags %} -
    -
  • -

    {{ message|safe }}

    -
  • -
- {% endif %} - {% endfor %} - - {% for error in form.non_field_errors %} -

- {{ error|escape }} -

- {% endfor %} -
-
- -
- - -
-

-
-
+ {% include "hosting/includes/_card_input.html" %} {% endif %} diff --git a/hosting/templates/hosting/settings.html b/hosting/templates/hosting/settings.html index 0bafe8e5..5e898b04 100644 --- a/hosting/templates/hosting/settings.html +++ b/hosting/templates/hosting/settings.html @@ -30,12 +30,13 @@

{%trans "Credit Card"%}


- {% if credit_card_data.last4 %} + {% for card in cards_list %}
{% trans "Credit Card" %}
-
{% trans "Last" %} 4: *****{{credit_card_data.last4}}
-
{% trans "Type" %}: {{credit_card_data.cc_brand}}
+
{% trans "Last" %} 4: *****{{card.last4}}
+
{% trans "Type" %}: {{card.cc_brand}}
{% comment %} + {% endcomment %}
@@ -46,75 +47,18 @@
- {% endcomment %}
+ {% endfor %} + {% if credit_card_data.last4 %} {% else %}

{% trans "No Credit Cards Added" %}

{% blocktrans %}We are using Stripe for payment and do not store your information in our database.{% endblocktrans %}

- {% comment %}

{% trans "Add a new Card." %}

-

- {% blocktrans %}Please fill in your credit card information below. We are using Stripe for payment and do not store your information in our database.{% endblocktrans %} -

-
- -
-
- -
-
-
-
- -
-
-
- -
-
-
-
- - -
-
- -
- {% if not messages and not form.non_field_errors %} -

- {% blocktrans %}You are not making any payment here.{% endblocktrans %} -

- {% endif %} -
- {% for message in messages %} - {% if 'failed_payment' or 'make_charge_error' in message.tags %} -
  • -

    {{ message|safe }}

    -
- {% endif %} - {% endfor %} - - {% for error in form.non_field_errors %} -

- {{ error|escape }} -

- {% endfor %} -
-
-
- -
-
-
- -
-

-
-
+ {% include "hosting/includes/_card_input.html" %} + {% comment %} {% endcomment %} {% endif %}
@@ -123,7 +67,6 @@ - {% comment %} {% if stripe_key %} {% get_current_language as LANGUAGE_CODE %} @@ -138,6 +81,7 @@ {%endif%} + {% comment %} {% if credit_card_data.last4 and credit_card_data.cc_brand %} {%endif%} - -{% if credit_card_data.last4 and credit_card_data.cc_brand %} - -{%endif%} - {%endblock%} From 248283b369c55b3989c421a93921453d33248f42 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 28 Oct 2017 23:44:06 +0200 Subject: [PATCH 0072/1159] Show user's credit cards dynamically in landing payment page --- .../datacenterlight/landing_payment.html | 35 ++++++++++++++----- datacenterlight/views.py | 11 +++++- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/landing_payment.html b/datacenterlight/templates/datacenterlight/landing_payment.html index 58246b6a..69c80d35 100644 --- a/datacenterlight/templates/datacenterlight/landing_payment.html +++ b/datacenterlight/templates/datacenterlight/landing_payment.html @@ -84,11 +84,35 @@
+ {% with card_list_len=cards_list|length %}

{%trans "Credit Card"%}


+ {% if card_list_len > 0 %} + {% blocktrans %}Please select one of the previous cards that you used before or fill in your credit card information below. We are using Stripe for payment and do not store your information in our database.{% endblocktrans %} + {% else %} {% blocktrans %}Please fill in your credit card information below. We are using Stripe for payment and do not store your information in our database.{% endblocktrans %} + {% endif %}

+
+ {% for card in cards_list %} +
+
+
{% trans "Credit Card" %}
+
{% trans "Last" %} 4: ***** {{card.last4}}
+
{% trans "Type" %}: {{card.brand}}
+
+ +
+ {% endfor %} + {% if card_list_len > 0 %} +
Use another card
+ {% endif %} + {% include "hosting/includes/_card_input.html" %} +
+ {% comment %}
{% if credit_card_data.last4 %}
@@ -125,6 +149,8 @@ {% include "hosting/includes/_card_input.html" %} {% endif %}
+ {% endcomment %} + {% endwith %}
@@ -144,13 +170,4 @@ })(); {%endif%} - -{% if credit_card_data.last4 and credit_card_data.cc_brand %} - -{%endif%} - {%endblock%} diff --git a/datacenterlight/views.py b/datacenterlight/views.py index bd1a7f51..861817e1 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -14,7 +14,7 @@ from django.views.decorators.cache import cache_control from django.views.generic import FormView, CreateView, TemplateView, DetailView from datacenterlight.tasks import create_vm_task -from hosting.models import HostingOrder +from hosting.models import HostingOrder, UserCardDetail from hosting.forms import HostingUserLoginForm from membership.models import CustomUser, StripeCustomer from opennebula_api.serializers import VMTemplateSerializer @@ -347,6 +347,14 @@ class PaymentOrderView(FormView): def get_context_data(self, **kwargs): context = super(PaymentOrderView, self).get_context_data(**kwargs) + user = self.request.user + if hasattr(user, 'stripecustomer'): + stripe_customer = user.stripecustomer + else: + stripe_customer = None + cards_list = UserCardDetail.get_all_cards_list( + stripe_customer=stripe_customer + ) if 'billing_address_data' in self.request.session: billing_address_data = self.request.session['billing_address_data'] else: @@ -380,6 +388,7 @@ class PaymentOrderView(FormView): ) context.update({ + 'cards_list': cards_list, 'stripe_key': settings.STRIPE_API_PUBLIC_KEY, 'site_url': reverse('datacenterlight:index'), 'login_form': HostingUserLoginForm(prefix='login_form'), From 2ffaee2d5b9722a50ed33e5d6a338df77af5232c Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 13:14:29 +0100 Subject: [PATCH 0073/1159] Add clear_items_from_list utility function --- utils/hosting_utils.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/utils/hosting_utils.py b/utils/hosting_utils.py index 3c193ad7..9541588d 100644 --- a/utils/hosting_utils.py +++ b/utils/hosting_utils.py @@ -60,3 +60,23 @@ def get_vm_price(cpu, memory, disk_size): :return: The price of the VM """ return (cpu * 5) + (memory * 2) + (disk_size * 0.6) + + +class HostingUtils: + @staticmethod + def clear_items_from_list(from_list, items_list): + """ + A utility function to clear items from a given list. + Useful when deleting items in bulk from session. + e.g.: + HostingUtils.clear_items_from_list( + request.session, + ['token', 'billing_address_data', 'card_id',] + ) + :param from_list: + :param items_list: + :return: + """ + for var in items_list: + if var in from_list: + del from_list[var] From 82ad9ac337a9f9ab83256debecc05160b7379274 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 13:17:26 +0100 Subject: [PATCH 0074/1159] Add selected card handling in landing flow "Order confirmation" page --- datacenterlight/views.py | 172 +++++++++++++++++++++++++++------------ 1 file changed, 122 insertions(+), 50 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 861817e1..baec4ee6 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -21,7 +21,7 @@ from opennebula_api.serializers import VMTemplateSerializer from utils.forms import ( BillingAddressForm, BillingAddressFormSignup ) -from utils.hosting_utils import get_vm_price +from utils.hosting_utils import get_vm_price, HostingUtils from utils.mailer import BaseEmail from utils.stripe_utils import StripeUtils from utils.tasks import send_plain_email_task @@ -401,6 +401,13 @@ class PaymentOrderView(FormView): # user is no longer added to session on the index page if 'specs' not in request.session: return HttpResponseRedirect(reverse('datacenterlight:index')) + HostingUtils.clear_items_from_list( + request.session, + ['token', 'billing_address_data', 'card_id', 'customer', + 'user'] + ) + if 'token' in request.session: + del request.session['token'] return self.render_to_response(self.get_context_data()) def post(self, request, *args, **kwargs): @@ -436,8 +443,40 @@ class PaymentOrderView(FormView): 'name': request.user.name } customer = StripeCustomer.get_or_create( - email=this_user.get('email'), - token=token) + email=this_user.get('email'), token=token + ) + if token is '': + # card selected case + card_id = address_form.cleaned_data.get('card') + try: + user_card_detail = UserCardDetail.objects.get( + id=card_id) + if not request.user.has_perm( + 'view_usercarddetail', user_card_detail + ): + raise UserCardDetail.DoesNotExist( + _( + "{user} does not have permission to access the " + "card").format(user=request.user.email) + ) + except UserCardDetail.DoesNotExist as e: + ex = str(e) + logger.error( + "Card Id: {card_id}, Exception: {ex}".format( + card_id=card_id, ex=ex + ) + ) + msg = _("An error occurred. Details: {}".format(ex)) + messages.add_message( + self.request, messages.ERROR, msg, + extra_tags='make_charge_error' + ) + return HttpResponseRedirect( + reverse('hosting:payment') + '#payment_error' + ) + request.session['card_id'] = user_card_detail.id + else: + request.session['token'] = token else: user_email = address_form.cleaned_data.get('email') user_name = address_form.cleaned_data.get('name') @@ -472,7 +511,7 @@ class PaymentOrderView(FormView): email=user_email, token=token, customer_name=user_name) - + request.session['token'] = token request.session['billing_address_data'] = address_form.cleaned_data request.session['user'] = this_user # Get or create stripe customer @@ -485,7 +524,6 @@ class PaymentOrderView(FormView): billing_address_form=address_form ) ) - request.session['token'] = token if type(customer) is StripeCustomer: request.session['customer'] = customer.stripe_id else: @@ -508,27 +546,33 @@ class OrderConfirmationView(DetailView): def get(self, request, *args, **kwargs): if 'specs' not in request.session or 'user' not in request.session: return HttpResponseRedirect(reverse('datacenterlight:index')) - if 'token' not in request.session: + if 'token' not in request.session and 'card_id' not in request.session: return HttpResponseRedirect(reverse('datacenterlight:payment')) - stripe_api_cus_id = request.session.get('customer') - stripe_utils = StripeUtils() - card_details = stripe_utils.get_card_details(stripe_api_cus_id, - request.session.get( - 'token')) - if not card_details.get('response_object'): - msg = card_details.get('error') - messages.add_message(self.request, messages.ERROR, msg, - extra_tags='failed_payment') - return HttpResponseRedirect( - reverse('datacenterlight:payment') + '#payment_error') context = { 'site_url': reverse('datacenterlight:index'), - 'cc_last4': card_details.get('response_object').get('last4'), - 'cc_brand': card_details.get('response_object').get('brand'), 'vm': request.session.get('specs'), 'page_header_text': _('Confirm Order'), 'billing_address_data': request.session.get('billing_address_data') } + if 'token' in request.session: + stripe_utils = StripeUtils() + card_details = stripe_utils.get_cards_details_from_token( + request.session.get('token') + ) + card_detail_resp = card_details.get('response_object') + if not card_detail_resp: + msg = card_details.get('error') + messages.add_message(self.request, messages.ERROR, msg, + extra_tags='failed_payment') + return HttpResponseRedirect( + reverse('datacenterlight:payment') + '#payment_error') + context['cc_last4'] = card_detail_resp.get('last4') + context['cc_brand'] = card_detail_resp.get('brand') + else: + card_id = self.request.session.get('card_id') + card_detail = UserCardDetail.objects.get(id=card_id) + context['cc_last4'] = card_detail.last4 + context['cc_brand'] = card_detail.brand return render(request, self.template_name, context) def post(self, request, *args, **kwargs): @@ -538,43 +582,62 @@ class OrderConfirmationView(DetailView): stripe_api_cus_id = request.session.get('customer') vm_template_id = template.get('id', 1) stripe_utils = StripeUtils() - card_details = stripe_utils.get_card_details(stripe_api_cus_id, - request.session.get( - 'token')) - if not card_details.get('response_object'): - msg = card_details.get('error') - messages.add_message(self.request, messages.ERROR, msg, - extra_tags='failed_payment') - response = { - 'status': False, - 'redirect': "{url}#{section}".format( - url=reverse('datacenterlight:payment'), - section='payment_error'), - 'msg_title': str(_('Error.')), - 'msg_body': str( - _('There was a payment related error.' - ' On close of this popup, you will be redirected back to' - ' the payment page.')) + if 'token' in self.request.session: + card_details = stripe_utils.get_cards_details_from_token( + request.session['token'] + ) + if not card_details.get('response_object'): + msg = card_details.get('error') + messages.add_message(self.request, messages.ERROR, msg, + extra_tags='failed_payment') + response = { + 'status': False, + 'redirect': "{url}#{section}".format( + url=reverse('datacenterlight:payment'), + section='payment_error'), + 'msg_title': str(_('Error.')), + 'msg_body': str( + _('There was a payment related error.' + ' On close of this popup, you will be redirected back to' + ' the payment page.')) + } + return HttpResponse(json.dumps(response), + content_type="application/json") + card_details_dict = card_details.get('response_object') + ucd = UserCardDetail.contains( + request.user.stripecustomer, card_details_dict + ) + if not ucd: + stripe_utils.associate_customer_card( + stripe_api_cus_id, request.session['token'], + set_as_default=True + ) + else: + card_id = request.session.get('card_id') + user_card_detail = UserCardDetail.objects.get(id=card_id) + card_details_dict = { + 'last4': user_card_detail.last4, + 'brand': user_card_detail.brand } - return HttpResponse(json.dumps(response), - content_type="application/json") - card_details_dict = card_details.get('response_object') + if not user_card_detail.preferred: + UserCardDetail.set_default_card( + stripe_api_cus_id=stripe_api_cus_id, + stripe_source_id=user_card_detail.card_id + ) cpu = specs.get('cpu') memory = specs.get('memory') disk_size = specs.get('disk_size') amount_to_be_charged = specs.get('price') - plan_name = StripeUtils.get_stripe_plan_name(cpu=cpu, - memory=memory, - disk_size=disk_size) - stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu, - ram=memory, - ssd=disk_size, - version=1, - app='dcl') + plan_name = StripeUtils.get_stripe_plan_name( + cpu=cpu, memory=memory, disk_size=disk_size + ) + stripe_plan_id = StripeUtils.get_stripe_plan_id( + cpu=cpu, ram=memory, ssd=disk_size, version=1, app='dcl' + ) stripe_plan = stripe_utils.get_or_create_stripe_plan( - amount=amount_to_be_charged, - name=plan_name, - stripe_plan_id=stripe_plan_id) + amount=amount_to_be_charged, name=plan_name, + stripe_plan_id=stripe_plan_id + ) subscription_result = stripe_utils.subscribe_customer_to_plan( stripe_api_cus_id, [{"plan": stripe_plan.get( @@ -644,6 +707,15 @@ class OrderConfirmationView(DetailView): billing_address_data.update({ 'user': custom_user.id }) + if 'token' in request.session: + ucd = UserCardDetail.get_or_create_user_card_detail( + stripe_customer=self.request.user.stripecustomer, + card_details=card_details_dict + ) + UserCardDetail.save_default_card_local( + self.request.user.stripecustomer.stripe_id, + ucd.card_id + ) user = { 'name': custom_user.name, 'email': custom_user.email, From 23e7edf7c28af39b0d8d93517a47538b5cd1911c Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 14:40:15 +0100 Subject: [PATCH 0075/1159] Return True if associate_customer_card runs ok --- utils/stripe_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/stripe_utils.py b/utils/stripe_utils.py index 2742045a..cb9ae6fb 100644 --- a/utils/stripe_utils.py +++ b/utils/stripe_utils.py @@ -86,6 +86,7 @@ class StripeUtils(object): if set_as_default: customer.default_source = card.id customer.save() + return True @handleStripeError def dissociate_customer_card(self, stripe_customer_id, card_id): From bea3477d848a8f87526e44ece06df5c0352ee801 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 14:45:14 +0100 Subject: [PATCH 0076/1159] Handle errors related to payment by redirecting to payment page --- datacenterlight/views.py | 39 ++++++++++++++++++++++++++--- hosting/views.py | 54 +++++++++++++++++++++++++++++++++++----- 2 files changed, 84 insertions(+), 9 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index baec4ee6..d9c0fbc1 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -603,21 +603,46 @@ class OrderConfirmationView(DetailView): } return HttpResponse(json.dumps(response), content_type="application/json") - card_details_dict = card_details.get('response_object') + card_details_response = card_details['response_object'] + card_details_dict = { + 'last4': card_details_response['last4'], + 'brand': card_details_response['brand'], + 'card_id': card_details_response['card_id'] + } ucd = UserCardDetail.contains( request.user.stripecustomer, card_details_dict ) if not ucd: - stripe_utils.associate_customer_card( + acc_result = stripe_utils.associate_customer_card( stripe_api_cus_id, request.session['token'], set_as_default=True ) + if acc_result['response_object'] is None: + response = { + 'status': False, + 'redirect': "{url}#{section}".format( + url=reverse('datacenterlight:payment'), + section='payment_error'), + 'msg_title': str(_('Error.')), + 'msg_body': str( + _('There was a payment related error.' + ' On close of this popup, you will be redirected back to' + ' the payment page.')) + } + logger.error( + "Card association failed. Error {error}".format( + error=acc_result['error'] + ) + ) + return HttpResponse(json.dumps(response), + content_type="application/json") else: card_id = request.session.get('card_id') user_card_detail = UserCardDetail.objects.get(id=card_id) card_details_dict = { 'last4': user_card_detail.last4, - 'brand': user_card_detail.brand + 'brand': user_card_detail.brand, + 'card_id': user_card_detail.card_id } if not user_card_detail.preferred: UserCardDetail.set_default_card( @@ -646,6 +671,14 @@ class OrderConfirmationView(DetailView): # Check if the subscription was approved and is active if (stripe_subscription_obj is None or stripe_subscription_obj.status != 'active'): + if request.user.is_authenticated(): + sac_id = request.user.stripecustomer.stripe_id + else: + sac_id = stripe_api_cus_id + stripe_utils.dissociate_customer_card( + sac_id, + card_details_dict['card_id'] + ) msg = subscription_result.get('error') messages.add_message(self.request, messages.ERROR, msg, extra_tags='failed_payment') diff --git a/hosting/views.py b/hosting/views.py index f61a4b19..6d5c9a78 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -632,6 +632,18 @@ class SettingsView(LoginRequiredMixin, FormView): msg = _('You seem to have already added this card') messages.add_message(request, messages.ERROR, msg) else: + acc_result = stripe_utils.associate_customer_card( + request.user.stripecustomer.stripe_id, token + ) + if acc_result['response_object'] is None: + msg = _( + 'An error occurred while associating the card.' + ' Details: {details}'.format( + details=acc_result['error'] + ) + ) + messages.add_message(request, messages.ERROR, msg) + return self.render_to_response(self.get_context_data()) preferred = False if stripe_customer.usercarddetail_set.count() == 0: preferred = True @@ -645,9 +657,6 @@ class SettingsView(LoginRequiredMixin, FormView): card_id=card['card_id'], preferred=preferred ) - stripe_utils.associate_customer_card( - request.user.stripecustomer.stripe_id, token - ) msg = _( "Successfully associated the card with your account" ) @@ -866,22 +875,48 @@ class OrdersHostingDetailView(LoginRequiredMixin, card_details_response = card_details['response_object'] card_details_dict = { 'last4': card_details_response['last4'], - 'brand': card_details_response['brand'] + 'brand': card_details_response['brand'], + 'card_id': card_details_response['card_id'] } ucd = UserCardDetail.contains( request.user.stripecustomer, card_details_response ) if not ucd: - stripe_utils.associate_customer_card( + acc_result = stripe_utils.associate_customer_card( stripe_api_cus_id, request.session['token'], set_as_default=True ) + if acc_result['response_object'] is None: + msg = _( + 'An error occurred while associating the card.' + ' Details: {details}'.format( + details=acc_result['error'] + ) + ) + messages.add_message(self.request, messages.ERROR, msg, + extra_tags='failed_payment') + response = { + 'status': False, + 'redirect': "{url}#{section}".format( + url=reverse('hosting:payment'), + section='payment_error'), + 'msg_title': str(_('Error.')), + 'msg_body': str( + _('There was a payment related error.' + ' On close of this popup, you will be redirected' + ' back to the payment page.') + ) + } + return HttpResponse( + json.dumps(response), content_type="application/json" + ) else: card_id = request.session.get('card_id') user_card_detail = UserCardDetail.objects.get(id=card_id) card_details_dict = { 'last4': user_card_detail.last4, - 'brand': user_card_detail.brand + 'brand': user_card_detail.brand, + 'card_id': user_card_detail.card_id } if not user_card_detail.preferred: UserCardDetail.set_default_card( @@ -911,6 +946,13 @@ class OrdersHostingDetailView(LoginRequiredMixin, # Check if the subscription was approved and is active if (stripe_subscription_obj is None or stripe_subscription_obj.status != 'active'): + # At this point, we have created a Stripe API card, but and + # associated it with the customer; but the transaction failed + # due to some reason. So, we dissociate this card. + stripe_utils.dissociate_customer_card( + request.user.stripecustomer.stripe_id, + card_details_dict['card_id'] + ) msg = subscription_result.get('error') messages.add_message(self.request, messages.ERROR, msg, extra_tags='failed_payment') From abe8c9efa52b13f4d87eb07392b63c0d3494a4ad Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 15:05:32 +0100 Subject: [PATCH 0077/1159] Add error details to messages datacenterlight landing flow --- datacenterlight/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index d9c0fbc1..f58b8276 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -610,7 +610,7 @@ class OrderConfirmationView(DetailView): 'card_id': card_details_response['card_id'] } ucd = UserCardDetail.contains( - request.user.stripecustomer, card_details_dict + request.user.stripecustomer, card_details_response ) if not ucd: acc_result = stripe_utils.associate_customer_card( @@ -618,6 +618,11 @@ class OrderConfirmationView(DetailView): set_as_default=True ) if acc_result['response_object'] is None: + msg = acc_result.get('error') + messages.add_message( + self.request, messages.ERROR, msg, + extra_tags='failed_payment' + ) response = { 'status': False, 'redirect': "{url}#{section}".format( From 63eb7fc0e2278721932adebe114e3cfe7236313e Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 21:31:11 +0100 Subject: [PATCH 0078/1159] Rename contains to get_user_card_details --- hosting/models.py | 9 +++++---- hosting/views.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hosting/models.py b/hosting/models.py index 9486eae7..7a181fe1 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -312,21 +312,22 @@ class UserCardDetail(AssignPermissionsMixin, models.Model): user_card_detail.save() @staticmethod - def contains(stripe_customer, card_details): + def get_user_card_details(stripe_customer, card_details): """ A utility function to check whether a StripeCustomer is already associated with the card having given details + :param stripe_customer: :param card_details: - :return: + :return: The UserCardDetails object if it exists, False otherwise """ try: - UserCardDetail.objects.get( + ucd = UserCardDetail.objects.get( stripe_customer=stripe_customer, fingerprint=card_details['fingerprint'], exp_month=card_details['exp_month'], exp_year=card_details['exp_year'] ) - return True + return ucd except UserCardDetail.DoesNotExist: return False diff --git a/hosting/views.py b/hosting/views.py index 6d5c9a78..5a9c2e2e 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -628,7 +628,7 @@ class SettingsView(LoginRequiredMixin, FormView): email=request.user.email, token=token ) card = card_details['response_object'] - if UserCardDetail.contains(stripe_customer, card): + if UserCardDetail.get_user_card_details(stripe_customer, card): msg = _('You seem to have already added this card') messages.add_message(request, messages.ERROR, msg) else: @@ -878,7 +878,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, 'brand': card_details_response['brand'], 'card_id': card_details_response['card_id'] } - ucd = UserCardDetail.contains( + ucd = UserCardDetail.get_user_card_details( request.user.stripecustomer, card_details_response ) if not ucd: From af1690b84621322c86fa27a07031d72388da614f Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 21:36:12 +0100 Subject: [PATCH 0079/1159] Fix: obtaining stripe_customer in landing flow --- datacenterlight/views.py | 82 ++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index f58b8276..1a817310 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -403,8 +403,7 @@ class PaymentOrderView(FormView): return HttpResponseRedirect(reverse('datacenterlight:index')) HostingUtils.clear_items_from_list( request.session, - ['token', 'billing_address_data', 'card_id', 'customer', - 'user'] + ['token', 'card_id', 'customer', 'user'] ) if 'token' in request.session: del request.session['token'] @@ -609,38 +608,49 @@ class OrderConfirmationView(DetailView): 'brand': card_details_response['brand'], 'card_id': card_details_response['card_id'] } - ucd = UserCardDetail.contains( - request.user.stripecustomer, card_details_response - ) - if not ucd: - acc_result = stripe_utils.associate_customer_card( - stripe_api_cus_id, request.session['token'], - set_as_default=True - ) - if acc_result['response_object'] is None: - msg = acc_result.get('error') - messages.add_message( - self.request, messages.ERROR, msg, - extra_tags='failed_payment' + s_cus = None + try: + s_cus = StripeCustomer.objects.get(stripe_id=stripe_api_cus_id) + except StripeCustomer.DoesNotExist: + pass + if s_cus: + ucd = UserCardDetail.get_user_card_details(s_cus, card_details_response) + if not ucd: + acc_result = stripe_utils.associate_customer_card( + stripe_api_cus_id, request.session['token'], + set_as_default=True ) - response = { - 'status': False, - 'redirect': "{url}#{section}".format( - url=reverse('datacenterlight:payment'), - section='payment_error'), - 'msg_title': str(_('Error.')), - 'msg_body': str( - _('There was a payment related error.' - ' On close of this popup, you will be redirected back to' - ' the payment page.')) - } - logger.error( - "Card association failed. Error {error}".format( - error=acc_result['error'] + if acc_result['response_object'] is None: + msg = acc_result.get('error') + messages.add_message( + self.request, messages.ERROR, msg, + extra_tags='failed_payment' + ) + response = { + 'status': False, + 'redirect': "{url}#{section}".format( + url=reverse('datacenterlight:payment'), + section='payment_error'), + 'msg_title': str(_('Error.')), + 'msg_body': str( + _('There was a payment related error.' + ' On close of this popup, you will be ' + 'redirected back to the payment page.') + ) + } + logger.error( + "Card association failed. Error {error}".format( + error=acc_result['error'] + ) + ) + return HttpResponse(json.dumps(response), + content_type="application/json") + else: + if not ucd.preferred: + UserCardDetail.set_default_card( + stripe_api_cus_id=stripe_api_cus_id, + stripe_source_id=ucd.card_id ) - ) - return HttpResponse(json.dumps(response), - content_type="application/json") else: card_id = request.session.get('card_id') user_card_detail = UserCardDetail.objects.get(id=card_id) @@ -745,13 +755,13 @@ class OrderConfirmationView(DetailView): billing_address_data.update({ 'user': custom_user.id }) - if 'token' in request.session: + if 'token' in request.session and s_cus is not None: ucd = UserCardDetail.get_or_create_user_card_detail( - stripe_customer=self.request.user.stripecustomer, - card_details=card_details_dict + stripe_customer=s_cus, + card_details=card_details_response ) UserCardDetail.save_default_card_local( - self.request.user.stripecustomer.stripe_id, + s_cus.stripe_id, ucd.card_id ) user = { From 618d0004f2456b236d4d427e98631234ea355922 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 21:41:54 +0100 Subject: [PATCH 0080/1159] Rearrange code --- datacenterlight/views.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 1a817310..36ca81d6 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -451,12 +451,11 @@ class PaymentOrderView(FormView): user_card_detail = UserCardDetail.objects.get( id=card_id) if not request.user.has_perm( - 'view_usercarddetail', user_card_detail + 'view_usercarddetail', user_card_detail ): raise UserCardDetail.DoesNotExist( - _( - "{user} does not have permission to access the " - "card").format(user=request.user.email) + _("{user} does not have permission to access" + " the card").format(user=request.user.email) ) except UserCardDetail.DoesNotExist as e: ex = str(e) @@ -496,9 +495,9 @@ class PaymentOrderView(FormView): ) ) customer = StripeCustomer.create_stripe_api_customer( - email=user_email, - token=token, - customer_name=user_name) + email=user_email, token=token, + customer_name=user_name + ) except CustomUser.DoesNotExist: logger.debug( ("StripeCustomer does not exist for {email}." @@ -597,8 +596,8 @@ class OrderConfirmationView(DetailView): 'msg_title': str(_('Error.')), 'msg_body': str( _('There was a payment related error.' - ' On close of this popup, you will be redirected back to' - ' the payment page.')) + ' On close of this popup, you will be redirected ' + 'back to the payment page.')) } return HttpResponse(json.dumps(response), content_type="application/json") From 3d8f81339b41218e58a2d8f2659d37781188838d Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 21:49:15 +0100 Subject: [PATCH 0081/1159] Refactor, reorganize some code --- datacenterlight/views.py | 42 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 36ca81d6..51cd18fd 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -560,10 +560,13 @@ class OrderConfirmationView(DetailView): card_detail_resp = card_details.get('response_object') if not card_detail_resp: msg = card_details.get('error') - messages.add_message(self.request, messages.ERROR, msg, - extra_tags='failed_payment') + messages.add_message( + self.request, messages.ERROR, msg, + extra_tags='failed_payment' + ) return HttpResponseRedirect( - reverse('datacenterlight:payment') + '#payment_error') + reverse('datacenterlight:payment') + '#payment_error' + ) context['cc_last4'] = card_detail_resp.get('last4') context['cc_brand'] = card_detail_resp.get('brand') else: @@ -586,8 +589,10 @@ class OrderConfirmationView(DetailView): ) if not card_details.get('response_object'): msg = card_details.get('error') - messages.add_message(self.request, messages.ERROR, msg, - extra_tags='failed_payment') + messages.add_message( + self.request, messages.ERROR, msg, + extra_tags='failed_payment' + ) response = { 'status': False, 'redirect': "{url}#{section}".format( @@ -599,8 +604,9 @@ class OrderConfirmationView(DetailView): ' On close of this popup, you will be redirected ' 'back to the payment page.')) } - return HttpResponse(json.dumps(response), - content_type="application/json") + return HttpResponse( + json.dumps(response), content_type="application/json" + ) card_details_response = card_details['response_object'] card_details_dict = { 'last4': card_details_response['last4'], @@ -709,7 +715,6 @@ class OrderConfirmationView(DetailView): } return HttpResponse(json.dumps(response), content_type="application/json") - # Create user if the user is not logged in and if he is not already # registered if not request.user.is_authenticated(): @@ -747,7 +752,6 @@ class OrderConfirmationView(DetailView): # object already exists stripe_customer_id = request.user.stripecustomer.id custom_user = request.user - # Save billing address billing_address_data = request.session.get('billing_address_data') logger.debug('billing_address_data is {}'.format(billing_address_data)) @@ -771,16 +775,16 @@ class OrderConfirmationView(DetailView): 'request_host': request.get_host(), 'language': get_language(), } - - create_vm_task.delay(vm_template_id, user, specs, template, - stripe_customer_id, billing_address_data, - stripe_subscription_obj.id, card_details_dict) - for session_var in ['specs', 'template', 'billing_address', - 'billing_address_data', - 'token', 'customer']: - if session_var in request.session: - del request.session[session_var] - + create_vm_task.delay( + vm_template_id, user, specs, template, stripe_customer_id, + billing_address_data, stripe_subscription_obj.id, + card_details_dict + ) + HostingUtils.clear_items_from_list( + request.session, + ['specs', 'template', 'billing_address', 'billing_address_data', + 'token', 'customer'] + ) response = { 'status': True, 'redirect': reverse( From edac806c118f642b737c7999c02d99643a67b639 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 21:56:29 +0100 Subject: [PATCH 0082/1159] Some more refactoring --- datacenterlight/views.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 51cd18fd..50148418 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -785,17 +785,18 @@ class OrderConfirmationView(DetailView): ['specs', 'template', 'billing_address', 'billing_address_data', 'token', 'customer'] ) + if request.user.is_authenticated(): + redirect_url = reverse('hosting:virtual_machines') + else: + redirect_url = reverse('datacenterlight:index') response = { 'status': True, - 'redirect': reverse( - 'hosting:virtual_machines') if request.user.is_authenticated() else reverse( - 'datacenterlight:index'), + 'redirect': redirect_url, 'msg_title': str(_('Thank you for the order.')), 'msg_body': str( _('Your VM will be up and running in a few moments.' ' We will send you a confirmation email as soon as' ' it is ready.')) } - return HttpResponse(json.dumps(response), content_type="application/json") From 62f30bf03c37301061b357ab14daa90ea363b648 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 22:03:19 +0100 Subject: [PATCH 0083/1159] Remove some commented and unnecessary code --- .../datacenterlight/landing_payment.html | 38 ------------------- datacenterlight/views.py | 15 -------- hosting/templates/hosting/settings.html | 10 ----- 3 files changed, 63 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/landing_payment.html b/datacenterlight/templates/datacenterlight/landing_payment.html index 69c80d35..5ac601ce 100644 --- a/datacenterlight/templates/datacenterlight/landing_payment.html +++ b/datacenterlight/templates/datacenterlight/landing_payment.html @@ -112,44 +112,6 @@ {% endif %} {% include "hosting/includes/_card_input.html" %} - {% comment %} -
- {% if credit_card_data.last4 %} - -
Credit Card
-
Last 4: *****{{credit_card_data.last4}}
-
Type: {{credit_card_data.cc_brand}}
- - - {% if not messages and not form.non_field_errors %} -

- {% trans "You are not making any payment yet. After submitting your card information, you will be taken to the Confirm Order Page." %} -

- {% endif %} -
- {% for message in messages %} - {% if 'failed_payment' or 'make_charge_error' in message.tags %} -
    -
  • -

    {{ message|safe }}

    -
  • -
- {% endif %} - {% endfor %} - {% for error in form.non_field_errors %} -

- {{ error|escape }} -

- {% endfor %} -
-
- -
- {% else %} - {% include "hosting/includes/_card_input.html" %} - {% endif %} -
- {% endcomment %} {% endwith %} diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 50148418..3a8bdac6 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -359,7 +359,6 @@ class PaymentOrderView(FormView): 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( @@ -369,24 +368,10 @@ class PaymentOrderView(FormView): 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({ 'cards_list': cards_list, 'stripe_key': settings.STRIPE_API_PUBLIC_KEY, diff --git a/hosting/templates/hosting/settings.html b/hosting/templates/hosting/settings.html index 6b5acbee..64057747 100644 --- a/hosting/templates/hosting/settings.html +++ b/hosting/templates/hosting/settings.html @@ -123,14 +123,4 @@ })(); {%endif%} - - {% comment %} - {% if credit_card_data.last4 and credit_card_data.cc_brand %} - - {%endif%} - {% endcomment %} {%endblock%} From 4be27962703cdb2774e1b0d13842ba3df3b22846 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 22:40:21 +0100 Subject: [PATCH 0084/1159] Clean up some unnecessary code --- datacenterlight/views.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 3a8bdac6..fb34f5b4 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -348,10 +348,9 @@ class PaymentOrderView(FormView): def get_context_data(self, **kwargs): context = super(PaymentOrderView, self).get_context_data(**kwargs) user = self.request.user + stripe_customer = None if hasattr(user, 'stripecustomer'): stripe_customer = user.stripecustomer - else: - stripe_customer = None cards_list = UserCardDetail.get_all_cards_list( stripe_customer=stripe_customer ) @@ -390,8 +389,6 @@ class PaymentOrderView(FormView): request.session, ['token', 'card_id', 'customer', 'user'] ) - if 'token' in request.session: - del request.session['token'] return self.render_to_response(self.get_context_data()) def post(self, request, *args, **kwargs): From 83dbae74e6a661b649f79d2b691ea8dc73a2e8d2 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 22:54:33 +0100 Subject: [PATCH 0085/1159] Add missing card_id to session variables to be cleared --- datacenterlight/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index fb34f5b4..f9d1dede 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -765,7 +765,7 @@ class OrderConfirmationView(DetailView): HostingUtils.clear_items_from_list( request.session, ['specs', 'template', 'billing_address', 'billing_address_data', - 'token', 'customer'] + 'token', 'customer', 'card_id'] ) if request.user.is_authenticated(): redirect_url = reverse('hosting:virtual_machines') From 16b6ecb38cdc87737c54e9f51e3ffa7eff51014a Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 23:48:33 +0100 Subject: [PATCH 0086/1159] Clear session variables on payment error --- hosting/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hosting/views.py b/hosting/views.py index 5a9c2e2e..37d6eabb 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -39,7 +39,7 @@ from utils.forms import ( BillingAddressForm, PasswordResetRequestForm, UserBillingAddressForm, ResendActivationEmailForm ) -from utils.hosting_utils import get_vm_price +from utils.hosting_utils import get_vm_price, HostingUtils from utils.mailer import BaseEmail from utils.stripe_utils import StripeUtils from utils.views import ( @@ -707,6 +707,10 @@ class PaymentVMView(LoginRequiredMixin, FormView): def get(self, request, *args, **kwargs): if 'next' in request.session: del request.session['next'] + HostingUtils.clear_items_from_list( + request.session, + ['token', 'card_id', 'customer', 'user'] + ) return self.render_to_response(self.get_context_data()) def post(self, request, *args, **kwargs): From 24d904288fd0724178af021fcbeec01fadf54947 Mon Sep 17 00:00:00 2001 From: PCoder Date: Mon, 30 Oct 2017 00:26:18 +0100 Subject: [PATCH 0087/1159] Clear token and card form variables explicitly --- datacenterlight/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index f9d1dede..f2af35cd 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -356,6 +356,10 @@ class PaymentOrderView(FormView): ) if 'billing_address_data' in self.request.session: billing_address_data = self.request.session['billing_address_data'] + if 'token' in billing_address_data: + billing_address_data.pop('token') + if 'card' in billing_address_data: + billing_address_data.pop('card') else: billing_address_data = {} if self.request.user.is_authenticated(): From a2a35a9475eb6bafd7d6d70d991416a21caab0f4 Mon Sep 17 00:00:00 2001 From: PCoder Date: Mon, 30 Oct 2017 08:26:35 +0100 Subject: [PATCH 0088/1159] Fix error accessing stripecustomer for user when it doesn't exist --- hosting/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hosting/views.py b/hosting/views.py index 37d6eabb..3b259242 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -552,8 +552,11 @@ class SettingsView(LoginRequiredMixin, FormView): def get_context_data(self, **kwargs): context = super(SettingsView, self).get_context_data(**kwargs) user = self.request.user + stripe_customer = None + if hasattr(user, 'stripecustomer'): + stripe_customer = user.stripecustomer cards_list = UserCardDetail.get_all_cards_list( - stripe_customer=user.stripecustomer + stripe_customer=stripe_customer ) context.update({ 'cards_list': cards_list, From 3e08760e044bfed66cb1363a4bfcb8de95b93d52 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 31 Oct 2017 08:58:43 +0100 Subject: [PATCH 0089/1159] Change letter-spacing to 2px for settings-container buttons --- hosting/static/hosting/css/commons.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/static/hosting/css/commons.css b/hosting/static/hosting/css/commons.css index 33381370..32a1338e 100644 --- a/hosting/static/hosting/css/commons.css +++ b/hosting/static/hosting/css/commons.css @@ -363,7 +363,7 @@ } .settings-container .choice-btn { - letter-spacing: 1px; + letter-spacing: 2px; min-width: 127px; } From d8ce0f95c5d92d2c9648051e5cef5f54f03ce04b Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 31 Oct 2017 09:02:07 +0100 Subject: [PATCH 0090/1159] Change letter-spacing to 2px for btn-vm-contact --- hosting/static/hosting/css/virtual-machine.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/static/hosting/css/virtual-machine.css b/hosting/static/hosting/css/virtual-machine.css index 3329d6fe..5f91fe2f 100644 --- a/hosting/static/hosting/css/virtual-machine.css +++ b/hosting/static/hosting/css/virtual-machine.css @@ -413,7 +413,7 @@ border: 2px solid #A3C0E2; padding: 5px 25px; font-size: 12px; - letter-spacing: 1.3px; + letter-spacing: 2px; } .btn-vm-contact:hover, .btn-vm-contact:focus { background: #fff; From f9bd8493330cd809f4c47ea98e7c21ba8b1fb1cd Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 31 Oct 2017 09:05:49 +0100 Subject: [PATCH 0091/1159] Remove redundant "previous" text --- .../templates/datacenterlight/landing_payment.html | 4 ++-- hosting/templates/hosting/payment.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/landing_payment.html b/datacenterlight/templates/datacenterlight/landing_payment.html index 5ac601ce..e0bd56a9 100644 --- a/datacenterlight/templates/datacenterlight/landing_payment.html +++ b/datacenterlight/templates/datacenterlight/landing_payment.html @@ -89,7 +89,7 @@

{% if card_list_len > 0 %} - {% blocktrans %}Please select one of the previous cards that you used before or fill in your credit card information below. We are using Stripe for payment and do not store your information in our database.{% endblocktrans %} + {% blocktrans %}Please select one of the cards that you used before or fill in your credit card information below. We are using Stripe for payment and do not store your information in our database.{% endblocktrans %} {% else %} {% blocktrans %}Please fill in your credit card information below. We are using Stripe for payment and do not store your information in our database.{% endblocktrans %} {% endif %} @@ -108,7 +108,7 @@ {% endfor %} {% if card_list_len > 0 %} -

Use another card
+
{% trans "Use another card" %}
{% endif %} {% include "hosting/includes/_card_input.html" %} diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index 10fd4674..a321b44c 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -72,7 +72,7 @@

{% if card_list_len > 0 %} - {% blocktrans %}Please select one of the previous cards that you used before or fill in your credit card information below. We are using Stripe for payment and do not store your information in our database.{% endblocktrans %} + {% blocktrans %}Please select one of the cards that you used before or fill in your credit card information below. We are using Stripe for payment and do not store your information in our database.{% endblocktrans %} {% else %} {% blocktrans %}Please fill in your credit card information below. We are using Stripe for payment and do not store your information in our database.{% endblocktrans %} {% endif %} @@ -91,7 +91,7 @@

{% endfor %} {% if card_list_len > 0 %} -
Use another card
+
{% trans "Use another card" %}
{% endif %} {% include "hosting/includes/_card_input.html" %} From c438c0d8cbab7d8518d929cc675fa5d8fc5d1d13 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 31 Oct 2017 09:38:36 +0100 Subject: [PATCH 0092/1159] Add some de translations --- .../locale/de/LC_MESSAGES/django.po | 48 +++++++--- hosting/locale/de/LC_MESSAGES/django.po | 87 +++++++++++++++---- 2 files changed, 108 insertions(+), 27 deletions(-) diff --git a/datacenterlight/locale/de/LC_MESSAGES/django.po b/datacenterlight/locale/de/LC_MESSAGES/django.po index 3b8c9ca6..2fe8dba8 100644 --- a/datacenterlight/locale/de/LC_MESSAGES/django.po +++ b/datacenterlight/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-17 00:32+0530\n" +"POT-Creation-Date: 2017-10-31 08:23+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -345,6 +345,17 @@ msgstr "Monat" msgid "Credit Card" msgstr "Kreditkarte" +msgid "" +"Please select one of the cards that you used before or fill in your credit " +"card information below. We are using Stripe for payment and do not store your information in our " +"database." +msgstr "" +"Bitte wähle Seine der Karten aus, die du zuvor verwendet hast, oder gib " +"deine Kreditkartendaten unten ein. Wir verwenden Stripe als " +"Zahlungdiensleister und speichern deine Daten nicht in unserer Datenbank." + msgid "" "Please fill in your credit card information below. We are using Stripe for payment and do not " @@ -354,12 +365,17 @@ msgstr "" "\"https://stripe.com\" target=\"_blank\">Stripe für die Bezahlung und " "speichern keine Informationen in unserer Datenbank." -msgid "" -"You are not making any payment yet. After submitting your card information, " -"you will be taken to the Confirm Order Page." -msgstr "" -"Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst ausgelöst, " -"nachdem Du die Bestellung auf der nächsten Seite bestätigt hast." +msgid "Last" +msgstr "Vor" + +msgid "Type" +msgstr "Kartentyp" + +msgid "SELECT" +msgstr "Auswählen" + +msgid "Use another card" +msgstr "Benutze eine andere Kreditkarte" msgid "Processing" msgstr "Weiter" @@ -471,6 +487,13 @@ msgstr "Ungültige RAM-Grösse" msgid "Invalid storage size" msgstr "Ungültige Speicher-Grösse" +#, python-brace-format +msgid "{user} does not have permission to access the card" +msgstr "" + +msgid "An error occurred. Details: {}" +msgstr "" + msgid "Confirm Order" msgstr "Bestellung Bestätigen" @@ -494,15 +517,20 @@ msgstr "" "Deine VM ist gleich bereit. Wir senden Dir eine Bestätigungsemail, sobald Du " "auf sie zugreifen kannst." +#~ msgid "" +#~ "You are not making any payment yet. After submitting your card " +#~ "information, you will be taken to the Confirm Order Page." +#~ msgstr "" +#~ "Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst " +#~ "ausgelöst, nachdem Du die Bestellung auf der nächsten Seite bestätigt " +#~ "hast." + #~ msgid "Card Number" #~ msgstr "Kreditkartennummer" #~ msgid "Expiry Date" #~ msgstr "Ablaufdatum" -#~ msgid "Card Type" -#~ msgstr "Kartentyp" - #~ msgid "Processing..." #~ msgstr "Abarbeitung..." diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index 64e4a73e..3614dc49 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-17 00:32+0530\n" +"POT-Creation-Date: 2017-10-31 08:23+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -437,6 +437,17 @@ msgstr "inkl. Mehrwertsteuer" msgid "Billing Address" msgstr "Rechnungsadresse" +msgid "" +"Please select one of the cards that you used before or fill in your credit " +"card information below. We are using Stripe for payment and do not store your information in our " +"database." +msgstr "" +"Bitte wähle Seine der Karten aus, die du zuvor verwendet hast, oder gib " +"deine Kreditkartendaten unten ein. Wir verwenden Stripe als " +"Zahlungdiensleister und speichern deine Daten nicht in unserer Datenbank." + msgid "" "Please fill in your credit card information below. We are using Stripe for payment and do not " @@ -446,12 +457,17 @@ msgstr "" "\"https://stripe.com\" target=\"_blank\">Stripe für die Bezahlung und " "speichern keine Informationen in unserer Datenbank." -msgid "" -"You are not making any payment yet. After submitting your card information, " -"you will be taken to the Confirm Order Page." -msgstr "" -"Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst ausgelöst, " -"nachdem Du die Bestellung auf der nächsten Seite bestätigt hast." +msgid "Last" +msgstr "Vor" + +msgid "Type" +msgstr "Kartentyp" + +msgid "SELECT" +msgstr "Auswählen" + +msgid "Use another card" +msgstr "Benutze eine andere Kreditkarte" msgid "Processing" msgstr "Weiter" @@ -468,16 +484,19 @@ msgstr "Passwort zurücksetzen" msgid "UPDATE" msgstr "" -msgid "Last" -msgstr "" - -msgid "Type" -msgstr "Kartentyp" - msgid "REMOVE CARD" msgstr "KARTE ENTFERNEN" -msgid "SELECT" +msgid "Remove Card" +msgstr "Karte Entfernen" + +msgid "Do you want to remove this associated card?" +msgstr "" + +msgid "Delete" +msgstr "Löschen" + +msgid "DEFAULT" msgstr "" msgid "No Credit Cards Added" @@ -534,9 +553,6 @@ msgstr "" msgid "Private Key" msgstr "" -msgid "Delete" -msgstr "Löschen" - msgid "Delete SSH Key" msgstr "SSH Key löschen" @@ -668,6 +684,35 @@ msgstr "Dein Passwort konnte nicht zurückgesetzt werden." msgid "The reset password link is no longer valid." msgstr "Der Link zum Zurücksetzen Deines Passwortes ist nicht mehr gültig." +msgid "Card deassociation successful" +msgstr "" + +msgid "You are not permitted to do this operation" +msgstr "" + +msgid "The selected card does not exist" +msgstr "" + +msgid "Billing address updated successfully" +msgstr "" + +msgid "You seem to have already added this card" +msgstr "" + +#, python-brace-format +msgid "An error occurred while associating the card. Details: {details}" +msgstr "Beim Zuordnen der Karte ist ein Fehler aufgetreten. Details: {details}" + +msgid "Successfully associated the card with your account" +msgstr "" + +#, python-brace-format +msgid "{user} does not have permission to access the card" +msgstr "" + +msgid "An error occurred. Details: {}" +msgstr "" + msgid "Invalid credit card" msgstr "Ungültige Kreditkarte" @@ -735,6 +780,14 @@ msgstr "" "Es gab einen Fehler bei der Bearbeitung Deine Anfrage. Bitte versuche es " "noch einmal." +#~ msgid "" +#~ "You are not making any payment yet. After submitting your card " +#~ "information, you will be taken to the Confirm Order Page." +#~ msgstr "" +#~ "Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst " +#~ "ausgelöst, nachdem Du die Bestellung auf der nächsten Seite bestätigt " +#~ "hast." + #~ msgid "Reset your password" #~ msgstr "Passwort zurücksetzen" From 272e14f71253dbf2dcac22a1a8f0e7cf889be301 Mon Sep 17 00:00:00 2001 From: PCoder Date: Mon, 27 Nov 2017 08:43:34 +0100 Subject: [PATCH 0093/1159] Update hosting django.po --- hosting/locale/de/LC_MESSAGES/django.po | 42 +++---------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index 6721a75c..6774fa8d 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-31 08:23+0000\n" +"POT-Creation-Date: 2017-11-27 07:43+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -453,9 +453,9 @@ msgid "" "database." msgstr "" "Bitte wähle Seine der Karten aus, die du zuvor verwendet hast, oder gib " -"deine Kreditkartendaten unten ein. Wir verwenden Stripe als " -"Zahlungdiensleister und speichern deine Daten nicht in unserer Datenbank." +"deine Kreditkartendaten unten ein. Wir verwenden Stripe als Zahlungdiensleister und speichern deine " +"Daten nicht in unserer Datenbank." msgid "" "Please fill in your credit card information below. We are using Stripe für die Bezahlung und " "speichern keine Informationen in unserer Datenbank." -msgid "" -"You are not making any payment yet. After submitting your card information, " -"you will be taken to the Confirm Order Page." -msgstr "" -"Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst ausgelöst, " -"nachdem Du die Bestellung auf der nächsten Seite bestätigt hast." - -msgid "SUBMIT" -msgstr "ABSENDEN" - -msgid "Card Number" -msgstr "Kreditkartennummer" - -msgid "Expiry Date" -msgstr "Ablaufdatum" - -msgid "CVC" -msgstr "" - -msgid "Card Type" -msgstr "Kartentyp" - msgid "Last" msgstr "Vor" @@ -524,12 +502,6 @@ msgstr "Karte Entfernen" msgid "Do you want to remove this associated card?" msgstr "" -msgid "Last" -msgstr "" - -msgid "Type" -msgstr "Kartentyp" - msgid "Delete" msgstr "Löschen" @@ -590,9 +562,6 @@ msgstr "" msgid "Private Key" msgstr "" -msgid "Delete" -msgstr "Löschen" - msgid "Delete SSH Key" msgstr "SSH Key löschen" @@ -894,9 +863,6 @@ msgstr "" #~ msgid "Notifications " #~ msgstr "Benachrichtigungen" -#~ msgid "REMOVE CARD" -#~ msgstr "KARTE ENTFERNEN" - #~ msgid "EDIT CARD" #~ msgstr "BEARBEITEN" From dd54b3052e284edc698f2161216da1e90be71a48 Mon Sep 17 00:00:00 2001 From: PCoder Date: Mon, 25 Dec 2017 15:07:12 +0100 Subject: [PATCH 0094/1159] Reorganize imports --- hosting/views.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hosting/views.py b/hosting/views.py index 576b3534..25d89b64 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -12,13 +12,13 @@ from django.contrib.auth.tokens import default_token_generator from django.core.exceptions import ValidationError from django.core.files.base import ContentFile from django.core.urlresolvers import reverse_lazy, reverse - from django.http import Http404, HttpResponseRedirect, HttpResponse from django.shortcuts import redirect, render from django.utils.http import urlsafe_base64_decode from django.utils.safestring import mark_safe from django.utils.translation import get_language, ugettext_lazy as _ from django.utils.translation import ugettext +from django.views.decorators.cache import cache_control from django.views.generic import ( View, CreateView, FormView, ListView, DetailView, DeleteView, TemplateView, UpdateView @@ -29,11 +29,14 @@ from stored_messages.api import mark_read from stored_messages.models import Message from stored_messages.settings import stored_messages_settings +from datacenterlight.models import VMTemplate from datacenterlight.tasks import create_vm_task from membership.models import CustomUser, StripeCustomer from opennebula_api.models import OpenNebulaManager -from opennebula_api.serializers import VirtualMachineSerializer, \ - VirtualMachineTemplateSerializer, VMTemplateSerializer +from opennebula_api.serializers import ( + VirtualMachineSerializer, VirtualMachineTemplateSerializer, + VMTemplateSerializer +) from utils.forms import ( BillingAddressForm, PasswordResetRequestForm, UserBillingAddressForm, ResendActivationEmailForm @@ -46,13 +49,14 @@ from utils.views import ( PasswordResetViewMixin, PasswordResetConfirmViewMixin, LoginViewMixin, ResendActivationLinkViewMixin ) -from .forms import HostingUserSignupForm, HostingUserLoginForm, \ - UserHostingKeyForm, generate_ssh_key_name +from .forms import ( + HostingUserSignupForm, HostingUserLoginForm, UserHostingKeyForm, + generate_ssh_key_name +) from .mixins import ProcessVMSelectionMixin from .models import ( HostingOrder, HostingBill, HostingPlan, UserHostingKey, VMDetail ) -from datacenterlight.models import VMTemplate logger = logging.getLogger(__name__) From b4f03b95531dce6772eac684ed29fb66693b9457 Mon Sep 17 00:00:00 2001 From: PCoder Date: Mon, 25 Dec 2017 15:10:34 +0100 Subject: [PATCH 0095/1159] Add cache_control decorator to all hosting views --- hosting/views.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/hosting/views.py b/hosting/views.py index 25d89b64..a6922a70 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -65,6 +65,7 @@ CONNECTION_ERROR = "Your VMs cannot be displayed at the moment due to a \ minutes." +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class DashboardView(LoginRequiredMixin, View): template_name = "hosting/dashboard.html" login_url = reverse_lazy('hosting:login') @@ -186,6 +187,7 @@ class HostingPricingView(ProcessVMSelectionMixin, View): return render(request, self.template_name, context) +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class IndexView(View): template_name = "hosting/index.html" @@ -210,6 +212,7 @@ class IndexView(View): return render(request, self.template_name, context) +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class LoginView(LoginViewMixin): template_name = "hosting/login.html" form_class = HostingUserLoginForm @@ -310,6 +313,7 @@ class SignupValidatedView(SignupValidateView): return context +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class ResendActivationEmailView(ResendActivationLinkViewMixin): template_name = 'hosting/resend_activation_link.html' form_class = ResendActivationEmailForm @@ -318,6 +322,7 @@ class ResendActivationEmailView(ResendActivationLinkViewMixin): email_template_name = 'user_activation' +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class PasswordResetView(PasswordResetViewMixin): site = 'dcl' template_name = 'hosting/reset_password.html' @@ -326,6 +331,7 @@ class PasswordResetView(PasswordResetViewMixin): template_email_path = 'hosting/emails/' +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class PasswordResetConfirmView(PasswordResetConfirmViewMixin): template_name = 'hosting/confirm_reset_password.html' success_url = reverse_lazy('hosting:login') @@ -402,6 +408,7 @@ class MarkAsReadNotificationView(LoginRequiredMixin, UpdateView): return HttpResponseRedirect(reverse('hosting:notifications')) +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class SSHKeyDeleteView(LoginRequiredMixin, DeleteView): login_url = reverse_lazy('hosting:login') success_url = reverse_lazy('hosting:ssh_keys') @@ -430,6 +437,7 @@ class SSHKeyDeleteView(LoginRequiredMixin, DeleteView): return super(SSHKeyDeleteView, self).delete(request, *args, **kwargs) +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class SSHKeyListView(LoginRequiredMixin, ListView): template_name = "hosting/user_keys.html" login_url = reverse_lazy('hosting:login') @@ -450,6 +458,7 @@ class SSHKeyListView(LoginRequiredMixin, ListView): **response_kwargs) +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class SSHKeyChoiceView(LoginRequiredMixin, View): template_name = "hosting/choice_ssh_keys.html" login_url = reverse_lazy('hosting:login') @@ -476,6 +485,7 @@ class SSHKeyChoiceView(LoginRequiredMixin, View): return redirect(reverse_lazy('hosting:ssh_keys'), foo='bar') +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class SSHKeyCreateView(LoginRequiredMixin, FormView): form_class = UserHostingKeyForm model = UserHostingKey @@ -538,6 +548,7 @@ class SSHKeyCreateView(LoginRequiredMixin, FormView): return self.form_invalid(form) +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class SettingsView(LoginRequiredMixin, FormView): template_name = "hosting/settings.html" login_url = reverse_lazy('hosting:login') @@ -589,6 +600,7 @@ class SettingsView(LoginRequiredMixin, FormView): return self.form_invalid(form) +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class PaymentVMView(LoginRequiredMixin, FormView): template_name = 'hosting/payment.html' login_url = reverse_lazy('hosting:login') @@ -667,8 +679,8 @@ class PaymentVMView(LoginRequiredMixin, FormView): return self.form_invalid(form) -class OrdersHostingDetailView(LoginRequiredMixin, - DetailView): +@cache_control(no_cache=True, must_revalidate=True, no_store=True) +class OrdersHostingDetailView(LoginRequiredMixin, DetailView): template_name = "hosting/order_detail.html" context_object_name = "order" login_url = reverse_lazy('hosting:login') @@ -881,6 +893,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, content_type="application/json") +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class OrdersHostingListView(LoginRequiredMixin, ListView): template_name = "hosting/orders.html" login_url = reverse_lazy('hosting:login') @@ -895,6 +908,7 @@ class OrdersHostingListView(LoginRequiredMixin, ListView): return super(OrdersHostingListView, self).get_queryset() +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class OrdersHostingDeleteView(LoginRequiredMixin, DeleteView): login_url = reverse_lazy('hosting:login') success_url = reverse_lazy('hosting:orders') @@ -939,6 +953,7 @@ class VirtualMachinesPlanListView(LoginRequiredMixin, ListView): return context +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class CreateVirtualMachinesView(LoginRequiredMixin, View): template_name = "hosting/create_virtual_machine.html" login_url = reverse_lazy('hosting:login') @@ -1011,6 +1026,7 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View): return redirect(reverse('hosting:payment')) +@cache_control(no_cache=True, must_revalidate=True, no_store=True) class VirtualMachineView(LoginRequiredMixin, View): template_name = "hosting/virtual_machine_detail.html" login_url = reverse_lazy('hosting:login') From f357c83fc4c7edef344d8f1c9a79ddf1ca00bc69 Mon Sep 17 00:00:00 2001 From: PCoder Date: Mon, 25 Dec 2017 15:53:24 +0100 Subject: [PATCH 0096/1159] Remove cache_control headers from Classes --- hosting/views.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/hosting/views.py b/hosting/views.py index a6922a70..3a596394 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -65,7 +65,6 @@ CONNECTION_ERROR = "Your VMs cannot be displayed at the moment due to a \ minutes." -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class DashboardView(LoginRequiredMixin, View): template_name = "hosting/dashboard.html" login_url = reverse_lazy('hosting:login') @@ -187,7 +186,6 @@ class HostingPricingView(ProcessVMSelectionMixin, View): return render(request, self.template_name, context) -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class IndexView(View): template_name = "hosting/index.html" @@ -212,7 +210,6 @@ class IndexView(View): return render(request, self.template_name, context) -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class LoginView(LoginViewMixin): template_name = "hosting/login.html" form_class = HostingUserLoginForm @@ -313,7 +310,6 @@ class SignupValidatedView(SignupValidateView): return context -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class ResendActivationEmailView(ResendActivationLinkViewMixin): template_name = 'hosting/resend_activation_link.html' form_class = ResendActivationEmailForm @@ -322,7 +318,6 @@ class ResendActivationEmailView(ResendActivationLinkViewMixin): email_template_name = 'user_activation' -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class PasswordResetView(PasswordResetViewMixin): site = 'dcl' template_name = 'hosting/reset_password.html' @@ -331,7 +326,6 @@ class PasswordResetView(PasswordResetViewMixin): template_email_path = 'hosting/emails/' -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class PasswordResetConfirmView(PasswordResetConfirmViewMixin): template_name = 'hosting/confirm_reset_password.html' success_url = reverse_lazy('hosting:login') @@ -408,7 +402,6 @@ class MarkAsReadNotificationView(LoginRequiredMixin, UpdateView): return HttpResponseRedirect(reverse('hosting:notifications')) -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class SSHKeyDeleteView(LoginRequiredMixin, DeleteView): login_url = reverse_lazy('hosting:login') success_url = reverse_lazy('hosting:ssh_keys') @@ -437,7 +430,6 @@ class SSHKeyDeleteView(LoginRequiredMixin, DeleteView): return super(SSHKeyDeleteView, self).delete(request, *args, **kwargs) -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class SSHKeyListView(LoginRequiredMixin, ListView): template_name = "hosting/user_keys.html" login_url = reverse_lazy('hosting:login') @@ -458,7 +450,6 @@ class SSHKeyListView(LoginRequiredMixin, ListView): **response_kwargs) -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class SSHKeyChoiceView(LoginRequiredMixin, View): template_name = "hosting/choice_ssh_keys.html" login_url = reverse_lazy('hosting:login') @@ -485,7 +476,6 @@ class SSHKeyChoiceView(LoginRequiredMixin, View): return redirect(reverse_lazy('hosting:ssh_keys'), foo='bar') -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class SSHKeyCreateView(LoginRequiredMixin, FormView): form_class = UserHostingKeyForm model = UserHostingKey @@ -548,7 +538,6 @@ class SSHKeyCreateView(LoginRequiredMixin, FormView): return self.form_invalid(form) -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class SettingsView(LoginRequiredMixin, FormView): template_name = "hosting/settings.html" login_url = reverse_lazy('hosting:login') @@ -600,7 +589,6 @@ class SettingsView(LoginRequiredMixin, FormView): return self.form_invalid(form) -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class PaymentVMView(LoginRequiredMixin, FormView): template_name = 'hosting/payment.html' login_url = reverse_lazy('hosting:login') @@ -679,7 +667,6 @@ class PaymentVMView(LoginRequiredMixin, FormView): return self.form_invalid(form) -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class OrdersHostingDetailView(LoginRequiredMixin, DetailView): template_name = "hosting/order_detail.html" context_object_name = "order" @@ -893,7 +880,6 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): content_type="application/json") -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class OrdersHostingListView(LoginRequiredMixin, ListView): template_name = "hosting/orders.html" login_url = reverse_lazy('hosting:login') @@ -908,7 +894,6 @@ class OrdersHostingListView(LoginRequiredMixin, ListView): return super(OrdersHostingListView, self).get_queryset() -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class OrdersHostingDeleteView(LoginRequiredMixin, DeleteView): login_url = reverse_lazy('hosting:login') success_url = reverse_lazy('hosting:orders') @@ -953,7 +938,6 @@ class VirtualMachinesPlanListView(LoginRequiredMixin, ListView): return context -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class CreateVirtualMachinesView(LoginRequiredMixin, View): template_name = "hosting/create_virtual_machine.html" login_url = reverse_lazy('hosting:login') @@ -1026,7 +1010,6 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View): return redirect(reverse('hosting:payment')) -@cache_control(no_cache=True, must_revalidate=True, no_store=True) class VirtualMachineView(LoginRequiredMixin, View): template_name = "hosting/virtual_machine_detail.html" login_url = reverse_lazy('hosting:login') From d796272c1053f644758bab7eb3a6b0f48bb90734 Mon Sep 17 00:00:00 2001 From: PCoder Date: Mon, 25 Dec 2017 15:54:23 +0100 Subject: [PATCH 0097/1159] Add cache_control headers to get and post methods --- hosting/views.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hosting/views.py b/hosting/views.py index 3a596394..879fc3e7 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -73,6 +73,7 @@ class DashboardView(LoginRequiredMixin, View): context = {} return context + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): context = self.get_context_data() return render(request, self.template_name, context) @@ -204,9 +205,9 @@ class IndexView(View): } return context + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): context = self.get_context_data() - return render(request, self.template_name, context) @@ -443,6 +444,7 @@ class SSHKeyListView(LoginRequiredMixin, ListView): self.queryset = UserHostingKey.objects.filter(user=user) return super(SSHKeyListView, self).get_queryset() + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def render_to_response(self, context, **response_kwargs): if not self.queryset: return HttpResponseRedirect(reverse('hosting:choice_ssh_keys')) @@ -454,10 +456,12 @@ class SSHKeyChoiceView(LoginRequiredMixin, View): template_name = "hosting/choice_ssh_keys.html" login_url = reverse_lazy('hosting:login') + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): context = {} return render(request, self.template_name, context) + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def post(self, request, *args, **kwargs): name = generate_ssh_key_name() private_key, public_key = UserHostingKey.generate_keys() @@ -527,6 +531,10 @@ class SSHKeyCreateView(LoginRequiredMixin, FormView): manager.manage_public_key([{'value': public_key, 'state': True}]) return HttpResponseRedirect(self.success_url) + @cache_control(no_cache=True, must_revalidate=True, no_store=True) + def get(self, request, *args, **kwargs): + return render(request, self.template_name) + def post(self, request, *args, **kwargs): form = self.get_form() required = 'add_ssh' in self.request.POST @@ -572,6 +580,10 @@ class SettingsView(LoginRequiredMixin, FormView): return context + @cache_control(no_cache=True, must_revalidate=True, no_store=True) + def get(self, request, *args, **kwargs): + return render(request, self.template_name) + def post(self, request, *args, **kwargs): form = self.get_form() if form.is_valid(): @@ -1045,6 +1057,7 @@ class VirtualMachineView(LoginRequiredMixin, View): final_url = reverse('hosting:virtual_machines') return final_url + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): vm = self.get_object() if vm is None: From 72baa3635bad0f94712f284d9b4abb3a7bb8b3ec Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 08:31:19 +0100 Subject: [PATCH 0098/1159] Add cache_control decorator to LoginViewMixin --- utils/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/views.py b/utils/views.py index 6e54cde6..394a9fc2 100644 --- a/utils/views.py +++ b/utils/views.py @@ -8,6 +8,7 @@ from django.utils.encoding import force_bytes from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode from django.utils.translation import ugettext_lazy as _ from django.views.generic import FormView, CreateView +from django.views.decorators.cache import cache_control from membership.models import CustomUser from .forms import SetPasswordForm @@ -57,6 +58,7 @@ class LoginViewMixin(FormView): return HttpResponseRedirect(self.get_success_url()) + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): if self.request.user.is_authenticated(): return HttpResponseRedirect(self.get_success_url()) From 87cdb08f3c94a70e100f41d879490c01e90feac1 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 08:32:55 +0100 Subject: [PATCH 0099/1159] Change success_url in hosting.SignupView from ssh_keys to dashboard --- hosting/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/views.py b/hosting/views.py index 879fc3e7..02e30808 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -221,7 +221,7 @@ class SignupView(CreateView): template_name = 'hosting/signup.html' form_class = HostingUserSignupForm model = CustomUser - success_url = reverse_lazy('hosting:ssh_keys') + success_url = reverse_lazy('hosting:dashboard') def get_success_url(self): next_url = self.request.session.get( From bec541c06a4b574d7ccc6b53d44e2f65e3570a18 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 08:33:53 +0100 Subject: [PATCH 0100/1159] Add get method to hosting.SignupView and cache_control --- hosting/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hosting/views.py b/hosting/views.py index 02e30808..7d60d7b4 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -239,6 +239,12 @@ class SignupView(CreateView): return HttpResponseRedirect(reverse_lazy('hosting:signup-validate')) + @cache_control(no_cache=True, must_revalidate=True, no_store=True) + def get(self, request, *args, **kwargs): + if self.request.user.is_authenticated(): + return HttpResponseRedirect(self.get_success_url()) + return super(SignupView, self).get(request, *args, **kwargs) + class SignupValidateView(TemplateView): template_name = "hosting/signup_validate.html" From 98e06686f9a556614301a5605de12be4b100a7f7 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 09:03:17 +0100 Subject: [PATCH 0101/1159] Add get method and cache_control to SignupValidatedView --- hosting/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hosting/views.py b/hosting/views.py index 7d60d7b4..76be4a67 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -316,6 +316,12 @@ class SignupValidatedView(SignupValidateView): context['section_title'] = section_title return context + @cache_control(no_cache=True, must_revalidate=True, no_store=True) + def get(self, request, *args, **kwargs): + if self.request.user.is_authenticated(): + return HttpResponseRedirect(reverse_lazy('hosting:dashboard')) + return super(SignupValidatedView, self).get(request, *args, **kwargs) + class ResendActivationEmailView(ResendActivationLinkViewMixin): template_name = 'hosting/resend_activation_link.html' From ab06eeff674ce7b59609957619eadf5a0e22fff7 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 09:04:58 +0100 Subject: [PATCH 0102/1159] Add cache_control to SSHKEyCreateView and SettingsView post methods --- hosting/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hosting/views.py b/hosting/views.py index 76be4a67..0b258536 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -547,6 +547,7 @@ class SSHKeyCreateView(LoginRequiredMixin, FormView): def get(self, request, *args, **kwargs): return render(request, self.template_name) + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def post(self, request, *args, **kwargs): form = self.get_form() required = 'add_ssh' in self.request.POST @@ -596,6 +597,7 @@ class SettingsView(LoginRequiredMixin, FormView): def get(self, request, *args, **kwargs): return render(request, self.template_name) + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def post(self, request, *args, **kwargs): form = self.get_form() if form.is_valid(): From 14ff876fbf9c984ce54a22ed1d913bb43441b993 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 09:06:46 +0100 Subject: [PATCH 0103/1159] Add cache_control to PaymentVMView and OrdersHostingDetailView --- hosting/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hosting/views.py b/hosting/views.py index 0b258536..26adb834 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -660,11 +660,13 @@ class PaymentVMView(LoginRequiredMixin, FormView): return context + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): if 'next' in request.session: del request.session['next'] return self.render_to_response(self.get_context_data()) + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def post(self, request, *args, **kwargs): form = self.get_form() if form.is_valid(): @@ -792,6 +794,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): context['vm'] = self.request.session.get('specs') return context + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): if not self.kwargs.get('pk'): if 'specs' not in self.request.session: @@ -813,6 +816,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): ) return self.render_to_response(context) + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def post(self, request): template = request.session.get('template') specs = request.session.get('specs') From 639e4cf414aaddd374e51286f5d2d02533d0f9c7 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 09:09:54 +0100 Subject: [PATCH 0104/1159] Add get method and cache_control to OrdersHostingListView --- hosting/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hosting/views.py b/hosting/views.py index 26adb834..b6d65455 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -923,6 +923,10 @@ class OrdersHostingListView(LoginRequiredMixin, ListView): self.queryset = HostingOrder.objects.filter(customer__user=user) return super(OrdersHostingListView, self).get_queryset() + @cache_control(no_cache=True, must_revalidate=True, no_store=True) + def get(self, request, *args, **kwargs): + return super(OrdersHostingListView, self).get(request, *args, **kwargs) + class OrdersHostingDeleteView(LoginRequiredMixin, DeleteView): login_url = reverse_lazy('hosting:login') From 1395c04a001033bc0813e4ada4f509dc7e90f85f Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 09:10:41 +0100 Subject: [PATCH 0105/1159] Add cache_control to CreateVirtualMachinesView and VirtualMachineView --- hosting/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hosting/views.py b/hosting/views.py index b6d65455..f43221c6 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -988,10 +988,12 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View): if (value > 2000) or (value < 10): raise ValidationError(_('Invalid storage size')) + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): context = {'templates': VMTemplate.objects.all()} return render(request, self.template_name, context) + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def post(self, request): cores = request.POST.get('cpu') cores_field = forms.IntegerField(validators=[self.validate_cores]) @@ -1114,6 +1116,7 @@ class VirtualMachineView(LoginRequiredMixin, View): return render(request, self.template_name, context) + @cache_control(no_cache=True, must_revalidate=True, no_store=True) def post(self, request, *args, **kwargs): response = {'status': False} admin_email_body = {} From 43999d803a8a3deb67bc7b94f359ce2a9f808097 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 3 Jan 2018 08:43:57 +0100 Subject: [PATCH 0106/1159] Add sdd_size, hdd_size to VirtualMachineSerializer --- opennebula_api/serializers.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/opennebula_api/serializers.py b/opennebula_api/serializers.py index 662b2fb6..07506a8b 100644 --- a/opennebula_api/serializers.py +++ b/opennebula_api/serializers.py @@ -49,6 +49,8 @@ class VirtualMachineSerializer(serializers.Serializer): memory = serializers.SerializerMethodField() disk_size = serializers.SerializerMethodField() + hdd_size = serializers.SerializerMethodField() + sdd_size = serializers.SerializerMethodField() ipv4 = serializers.SerializerMethodField() ipv6 = serializers.SerializerMethodField() vm_id = serializers.IntegerField(read_only=True, source='id') @@ -102,6 +104,22 @@ class VirtualMachineSerializer(serializers.Serializer): disk_size += int(disk.size) return disk_size / 1024 + def get_sdd_size(self, obj): + template = obj.template + disk_size = 0 + for disk in template.disks: + if disk.datastore == 'cephds': + disk_size += int(disk.size) + return disk_size / 1024 + + def get_hdd_size(self, obj): + template = obj.template + disk_size = 0 + for disk in template.disks: + if disk.datastore == 'ceph_hdd_ds': + disk_size += int(disk.size) + return disk_size / 1024 + def get_price(self, obj): template = obj.template price = float(template.vcpu) * 5.0 From 3d1738871b76fb0dcffd343a7a49603d97c0c5da Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 3 Jan 2018 08:54:19 +0100 Subject: [PATCH 0107/1159] Replace all ungleich.com with ungleich.ch --- digitalglarus/test_views.py | 2 +- hosting/test_forms.py | 2 +- hosting/test_views.py | 2 +- utils/mailer.py | 2 +- utils/tests.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/digitalglarus/test_views.py b/digitalglarus/test_views.py index b7fc6c3a..aff11081 100644 --- a/digitalglarus/test_views.py +++ b/digitalglarus/test_views.py @@ -224,7 +224,7 @@ class SignupViewTest(TestCase): self.view = SignupView self.signup_data = { 'name': 'ungleich', - 'email': 'test@ungleich.com', + 'email': 'test@ungleich.ch', 'password': 'fake_password', 'confirm_password': 'fake_password', } diff --git a/hosting/test_forms.py b/hosting/test_forms.py index 89ddb268..3dd4f8ff 100644 --- a/hosting/test_forms.py +++ b/hosting/test_forms.py @@ -30,7 +30,7 @@ class HostingUserSignupFormTest(TestCase): def setUp(self): self.completed_data = { 'name': 'test name', - 'email': 'test@ungleich.com', + 'email': 'test@ungleich.ch', 'password': 'test_password', 'confirm_password': 'test_password' } diff --git a/hosting/test_views.py b/hosting/test_views.py index 2c71959a..324aa4fa 100644 --- a/hosting/test_views.py +++ b/hosting/test_views.py @@ -505,7 +505,7 @@ class SignupViewTest(TestCase): self.view = SignupView self.signup_data = { 'name': 'ungleich', - 'email': 'test@ungleich.com', + 'email': 'test@ungleich.ch', 'password': 'fake_password', 'confirm_password': 'fake_password', } diff --git a/utils/mailer.py b/utils/mailer.py index d626e733..ae1d96da 100644 --- a/utils/mailer.py +++ b/utils/mailer.py @@ -25,7 +25,7 @@ class BaseEmail(object): self.email.from_email = kwargs.get('from_address') else: self.email.from_email = '(ungleich) ungleich Support ' - self.email.to = [kwargs.get('to', 'info@ungleich.com')] + self.email.to = [kwargs.get('to', 'info@ungleich.ch')] def send(self): self.email.send() diff --git a/utils/tests.py b/utils/tests.py index ce54800a..8abbbb1d 100644 --- a/utils/tests.py +++ b/utils/tests.py @@ -44,7 +44,7 @@ class BaseTestCase(TestCase): # Request Object self.request = HttpRequest() - self.request.META['SERVER_NAME'] = 'ungleich.com' + self.request.META['SERVER_NAME'] = 'ungleich.ch' self.request.META['SERVER_PORT'] = '80' def get_client(self, user): From 74626a59dcd604eb31c56297e0559cd0ab217743 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Fri, 5 Jan 2018 05:18:35 +0530 Subject: [PATCH 0108/1159] galsfaser section cms plugin extra padding fix --- ungleich_page/static/ungleich_page/css/agency.css | 13 ++++++++++++- .../templates/ungleich_page/glasfaser.html | 11 +++++------ .../glasfaser/section_text_glasfaser.html | 3 +-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ungleich_page/static/ungleich_page/css/agency.css b/ungleich_page/static/ungleich_page/css/agency.css index 43a05898..011781e3 100755 --- a/ungleich_page/static/ungleich_page/css/agency.css +++ b/ungleich_page/static/ungleich_page/css/agency.css @@ -280,7 +280,7 @@ fieldset[disabled] .btn-xl.active { } .navbar-default .navbar-brand { - padding: 4px 8px 12px; + padding: 8px 8px; } .navbar-default.navbar-shrink .navbar-brand { padding: 6px 8px 10px; @@ -345,6 +345,7 @@ header .intro-text .intro-heading { section { padding: 75px 0; + border-bottom: 1px solid #f3f4f5; } @media(max-width:767px) { @@ -353,6 +354,16 @@ section { } } +section .section-heading-contain { + margin-bottom: 50px; +} + +@media(min-width:767px) { + section .section-heading-contain { + margin-bottom: 75px; + } +} + section h2.section-heading { margin-top: 0; margin-bottom: 15px; diff --git a/ungleich_page/templates/ungleich_page/glasfaser.html b/ungleich_page/templates/ungleich_page/glasfaser.html index 3d8fbb76..77338ac9 100644 --- a/ungleich_page/templates/ungleich_page/glasfaser.html +++ b/ungleich_page/templates/ungleich_page/glasfaser.html @@ -83,7 +83,7 @@ -
+
@@ -96,13 +96,12 @@
-
+
-
+

Was ist es?

-

Bei diesem Angebot handelt es sich um einen Internetzugang für Firmenkunden.

@@ -114,7 +113,7 @@
-
+

Technische Details

Im Angebot enthalten sind

@@ -156,7 +155,7 @@
-
+

Wie funktioniert es?

So kommen Sie in wenigen einfachen Schritten zu Ihrem High-Speed-Internet

diff --git a/ungleich_page/templates/ungleich_page/glasfaser/section_text_glasfaser.html b/ungleich_page/templates/ungleich_page/glasfaser/section_text_glasfaser.html index d3d83dfc..06b0e26d 100644 --- a/ungleich_page/templates/ungleich_page/glasfaser/section_text_glasfaser.html +++ b/ungleich_page/templates/ungleich_page/glasfaser/section_text_glasfaser.html @@ -1,9 +1,8 @@
-
+

{{instance.title}}

-

{{instance.description}}

From 3ef2aa4bfbd007721845c679cd572d717d0da28d Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Fri, 5 Jan 2018 18:31:24 +0530 Subject: [PATCH 0109/1159] removed unused header plugins --- ungleich_page/cms_plugins.py | 70 +------------------ .../migrations/0018_auto_20180105_1826.py | 64 +++++++++++++++++ ungleich_page/models.py | 53 -------------- 3 files changed, 67 insertions(+), 120 deletions(-) create mode 100644 ungleich_page/migrations/0018_auto_20180105_1826.py diff --git a/ungleich_page/cms_plugins.py b/ungleich_page/cms_plugins.py index fb40ea2b..47f296aa 100644 --- a/ungleich_page/cms_plugins.py +++ b/ungleich_page/cms_plugins.py @@ -3,11 +3,10 @@ from cms.plugin_pool import plugin_pool from .models import ( UngelichContactUsSection, UngelichTextSection, Service, ServiceItem, - About, AboutItem, SectionWithImage, UngleichServiceItem, UngleichHeader, - UngleichHeaderItem, UngleichProductItem, UngleichProduct, UngleichCustomer, - UngleichCustomerItem, UngleichHTMLOnly, UngleichSimpleHeader, + About, AboutItem, SectionWithImage, UngleichServiceItem, + UngleichProductItem, UngleichProduct, UngleichCustomer, + UngleichCustomerItem, UngleichHTMLOnly, UngleichHeaderWithBackgroundImageSlider, - UngleichHeaderWithBackgroundImageSliderItem, UngleichHeaderWithBackgroundVideoSliderItem, ) @@ -184,49 +183,6 @@ class UngleichServicesItemPlugin(CMSPluginBase): return context -@plugin_pool.register_plugin -class UngleichHeaderWithTextAndImagePlugin(CMSPluginBase): - name = "ungleich Header with Text and Image Plugin" - model = UngleichSimpleHeader - render_template = "ungleich_page/ungleich/header.html" - cache = False - - def render(self, context, instance, placeholder): - context['instance'] = instance - return context - - -@plugin_pool.register_plugin -class UngleichHeaderWithTextAndImageSliderPlugin(CMSPluginBase): - name = "ungleich Header with Text and Image Slider Plugin" - model = UngleichHeader - render_template = "ungleich_page/ungleich/header_with_slider.html" - cache = False - allow_children = True - child_classes = ['UngleichHeaderItemPlugin'] - - def render(self, context, instance, placeholder): - context['instance'] = instance - return context - - -@plugin_pool.register_plugin -class UngleichHeaderItemPlugin(CMSPluginBase): - name = "ungleich Header Item Plugin" - model = UngleichHeaderItem - render_template = "ungleich_page/ungleich/_header_item.html" - cache = False - require_parent = True - parent_classes = ['UngleichHeaderWithTextAndImageSliderPlugin'] - - def render(self, context, instance, placeholder): - context = super(UngleichHeaderItemPlugin, self).render( - context, instance, placeholder - ) - context['instance'] = instance - return context - - @plugin_pool.register_plugin class UngleichHeaderBackgroundImageAndTextSliderPlugin(CMSPluginBase): name = "ungleich Header with Background and Image Slider Plugin" @@ -237,7 +193,6 @@ class UngleichHeaderBackgroundImageAndTextSliderPlugin(CMSPluginBase): cache = False allow_children = True child_classes = [ - 'UngleichHeaderBackgroundImageAndTextItemPlugin', 'UngleichHeaderBackgroundVideoItemPlugin', ] @@ -263,25 +218,6 @@ class UngleichHeaderBackgroundVideoItemPlugin(CMSPluginBase): return context -@plugin_pool.register_plugin -class UngleichHeaderBackgroundImageAndTextItemPlugin(CMSPluginBase): - name = "ungleich Header with Background and Image and Text Item Plugin" - model = UngleichHeaderWithBackgroundImageSliderItem - render_template = ( - 'ungleich_page/ungleich/_header_with_background_image_slider_item.html' - ) - cache = False - require_parent = True - parent_classes = ['UngleichHeaderBackgroundImageAndTextSliderPlugin'] - - def render(self, context, instance, placeholder): - context = super( - UngleichHeaderBackgroundImageAndTextItemPlugin, self - ).render(context, instance, placeholder) - context['instance'] = instance - return context - - @plugin_pool.register_plugin class UngleichProductsPlugin(CMSPluginBase): name = "ungleich Products Plugin" diff --git a/ungleich_page/migrations/0018_auto_20180105_1826.py b/ungleich_page/migrations/0018_auto_20180105_1826.py new file mode 100644 index 00000000..b269fb04 --- /dev/null +++ b/ungleich_page/migrations/0018_auto_20180105_1826.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-01-05 12:56 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms', '0014_auto_20160404_1908'), + ('ungleich_page', '0017_auto_20171219_1856'), + ] + + operations = [ + migrations.RemoveField( + model_name='ungleichheader', + name='background_image', + ), + migrations.RemoveField( + model_name='ungleichheader', + name='cmsplugin_ptr', + ), + migrations.RemoveField( + model_name='ungleichheaderitem', + name='cmsplugin_ptr', + ), + migrations.RemoveField( + model_name='ungleichheaderitem', + name='image', + ), + migrations.RemoveField( + model_name='ungleichheaderwithbackgroundimageslideritem', + name='background_image', + ), + migrations.RemoveField( + model_name='ungleichheaderwithbackgroundimageslideritem', + name='cmsplugin_ptr', + ), + migrations.RemoveField( + model_name='ungleichsimpleheader', + name='background_image', + ), + migrations.RemoveField( + model_name='ungleichsimpleheader', + name='cmsplugin_ptr', + ), + migrations.RemoveField( + model_name='ungleichsimpleheader', + name='image', + ), + migrations.DeleteModel( + name='UngleichHeader', + ), + migrations.DeleteModel( + name='UngleichHeaderItem', + ), + migrations.DeleteModel( + name='UngleichHeaderWithBackgroundImageSliderItem', + ), + migrations.DeleteModel( + name='UngleichSimpleHeader', + ), + ] diff --git a/ungleich_page/models.py b/ungleich_page/models.py index ad44c161..b96afcb1 100644 --- a/ungleich_page/models.py +++ b/ungleich_page/models.py @@ -98,63 +98,10 @@ class UngleichServiceItem(ServiceItem): ) -class UngleichSimpleHeader(CMSPlugin): - background_image = FilerImageField( - null=True, - blank=True, - related_name="ungleich_simple_header_background_image", - on_delete=models.SET_NULL - ) - image = FilerImageField( - null=True, - blank=True, - related_name="ungleich_simple_header_image", - on_delete=models.SET_NULL - ) - text = HTMLField() - - -class UngleichHeader(CMSPlugin): - background_image = FilerImageField( - null=True, - blank=True, - related_name="ungleich_header_background_image", - on_delete=models.SET_NULL - ) - carousel_data_interval = models.IntegerField(default=5000) - - -class UngleichHeaderWithBackgroundImageSliderItem(CMSPlugin): - background_image = FilerImageField( - null=True, blank=True, - related_name="ungleich_header_slider_item_image", - on_delete=models.SET_NULL - ) - description = HTMLField( - default='
We Design, Configure & Maintain ' - '
Your Linux Infrastructure

' - 'Ruby on Rails, Django, Java, Webserver, Mailserver, any ' - 'infrastructure that needs to configured, we provide ' - 'comprehensive solutions. Amazon, rackspace or bare metal ' - 'servers, we configure for you.

Learn More

' - ) - - class UngleichHeaderWithBackgroundImageSlider(CMSPlugin): carousel_data_interval = models.IntegerField(default=2000) -class UngleichHeaderItem(CMSPlugin): - image = FilerImageField( - null=True, - blank=True, - related_name="ungleich_header_item_image", - on_delete=models.SET_NULL - ) - description = HTMLField() - - class UngleichHeaderWithBackgroundVideoSliderItem(CMSPlugin): image = FilerImageField( null=True, From 6dd69b24fa41cb276fca6be99f28e2ac1816be35 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 7 Jan 2018 08:42:52 +0100 Subject: [PATCH 0110/1159] Replace another occurrence in a commented block --- nosystemd/templates/nosystemd/landing.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nosystemd/templates/nosystemd/landing.html b/nosystemd/templates/nosystemd/landing.html index 9836e86c..2e19af2f 100755 --- a/nosystemd/templates/nosystemd/landing.html +++ b/nosystemd/templates/nosystemd/landing.html @@ -96,7 +96,7 @@
From aff4288cd99c6f5215559c606a4632d81e6dc71a Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 7 Jan 2018 09:29:54 +0100 Subject: [PATCH 0111/1159] Update Changelog --- Changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog b/Changelog index 4a9945f9..010e094f 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +Next: + * #4000: [all] Replace all ungleich.com with ungleich.ch 1.3.1: 2017-12-31 * feature: [all] Load email configurations host, port and use_tls from env * bugfix: [all] Use ungleich's smtp as relayhost for sending emails From 205274be42c72b60e2ea8f5f50f29a05383c7418 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Sun, 7 Jan 2018 20:40:38 +0530 Subject: [PATCH 0112/1159] removed ununsed templates --- .../ungleich_page/ungleich/_header_item.html | 14 ------------- ...der_with_background_image_slider_item.html | 4 ---- .../ungleich_page/ungleich/header.html | 15 ------------- .../ungleich/header_with_slider.html | 21 ------------------- 4 files changed, 54 deletions(-) delete mode 100644 ungleich_page/templates/ungleich_page/ungleich/_header_item.html delete mode 100644 ungleich_page/templates/ungleich_page/ungleich/_header_with_background_image_slider_item.html delete mode 100644 ungleich_page/templates/ungleich_page/ungleich/header.html delete mode 100644 ungleich_page/templates/ungleich_page/ungleich/header_with_slider.html diff --git a/ungleich_page/templates/ungleich_page/ungleich/_header_item.html b/ungleich_page/templates/ungleich_page/ungleich/_header_item.html deleted file mode 100644 index a770d1ed..00000000 --- a/ungleich_page/templates/ungleich_page/ungleich/_header_item.html +++ /dev/null @@ -1,14 +0,0 @@ -
-
- {% if instance.image %} - -
- {% endif %} -
- - {{ instance.description }} - -
-
-
diff --git a/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_image_slider_item.html b/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_image_slider_item.html deleted file mode 100644 index 063a0a7b..00000000 --- a/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_image_slider_item.html +++ /dev/null @@ -1,4 +0,0 @@ -
-
- {{ instance.description }} -
\ No newline at end of file diff --git a/ungleich_page/templates/ungleich_page/ungleich/header.html b/ungleich_page/templates/ungleich_page/ungleich/header.html deleted file mode 100644 index 77c7ffdf..00000000 --- a/ungleich_page/templates/ungleich_page/ungleich/header.html +++ /dev/null @@ -1,15 +0,0 @@ -{% load cms_tags %} - -
-
-
- -


-
- - {{ instance.text }} - -
-
-
-
diff --git a/ungleich_page/templates/ungleich_page/ungleich/header_with_slider.html b/ungleich_page/templates/ungleich_page/ungleich/header_with_slider.html deleted file mode 100644 index 9cf759e6..00000000 --- a/ungleich_page/templates/ungleich_page/ungleich/header_with_slider.html +++ /dev/null @@ -1,21 +0,0 @@ -{% load cms_tags %} -
- -
\ No newline at end of file From 157cc5ac5d7161f5ff4442aa6936dae237988678 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Mon, 8 Jan 2018 00:56:54 +0530 Subject: [PATCH 0113/1159] fix datacenterlight templates --- .../datacenterlight/base_hosting.html | 117 ++++++++++++++++++ .../emails/base_email_datacenterlight.html | 2 + .../_calculator_form.html} | 0 .../templates/datacenterlight/index.html | 2 +- .../datacenterlight/landing_payment.html | 2 +- .../datacenterlight/order_detail.html | 2 +- .../datacenterlight/whydatacenterlight.html | 2 +- datacenterlight/urls.py | 4 +- datacenterlight/views.py | 2 + 9 files changed, 127 insertions(+), 6 deletions(-) create mode 100644 datacenterlight/templates/datacenterlight/base_hosting.html rename datacenterlight/templates/datacenterlight/{calculator_form.html => includes/_calculator_form.html} (100%) diff --git a/datacenterlight/templates/datacenterlight/base_hosting.html b/datacenterlight/templates/datacenterlight/base_hosting.html new file mode 100644 index 00000000..613d67a9 --- /dev/null +++ b/datacenterlight/templates/datacenterlight/base_hosting.html @@ -0,0 +1,117 @@ +{% load staticfiles bootstrap3%} +{% load i18n %} + + + + + + + + + + + + ungleich + + + + + + + + + + + + + + + {% block css_extra %} + {% endblock css_extra %} + + + + + + + + + + + + + {% include "google_analytics.html" %} + + + + + + + {% block navbar %} + {% include "hosting/includes/_navbar_user.html" %} + {% endblock navbar %} + +
+ {% block content %} + {% endblock %} +
+ + + {% if request.user.is_authenticated %} +
+
+ +
+
+ {% else %} + + {% endif %} + + + + + + + + + + + + + + + + + + + + + {% block js_extra %} + {% comment %} + this block is above some files, because on stripe error scripts below the stripe + script are not properly executed. + {% endcomment %} + {% endblock js_extra %} + + + + + + + + + + + + + + + + + + diff --git a/datacenterlight/templates/datacenterlight/emails/base_email_datacenterlight.html b/datacenterlight/templates/datacenterlight/emails/base_email_datacenterlight.html index be8479d9..3f06b069 100644 --- a/datacenterlight/templates/datacenterlight/emails/base_email_datacenterlight.html +++ b/datacenterlight/templates/datacenterlight/emails/base_email_datacenterlight.html @@ -1,5 +1,7 @@ {% load static from staticfiles %} {% load i18n %} +{% comment %} unused {% endcomment %} +
- {% include "datacenterlight/calculator_form.html" %} + {% include "datacenterlight/includes/_calculator_form.html" %}
diff --git a/datacenterlight/templates/datacenterlight/landing_payment.html b/datacenterlight/templates/datacenterlight/landing_payment.html index f2f75e9c..8e779576 100644 --- a/datacenterlight/templates/datacenterlight/landing_payment.html +++ b/datacenterlight/templates/datacenterlight/landing_payment.html @@ -1,4 +1,4 @@ -{% extends "hosting/base_short.html" %} +{% extends "datacenterlight/base_hosting.html" %} {% load staticfiles bootstrap3 i18n %} {% block css_extra %} diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index ec4befc9..79119777 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -1,4 +1,4 @@ -{% extends "hosting/order_detail.html" %} +{% extends "datacenterlight/base_hosting.html" %} {% load i18n %} {% block navbar %} diff --git a/datacenterlight/templates/datacenterlight/whydatacenterlight.html b/datacenterlight/templates/datacenterlight/whydatacenterlight.html index c54156b6..ee6cfefa 100644 --- a/datacenterlight/templates/datacenterlight/whydatacenterlight.html +++ b/datacenterlight/templates/datacenterlight/whydatacenterlight.html @@ -137,7 +137,7 @@
- {% include "datacenterlight/calculator_form.html" %} + {% include "datacenterlight/includes/_calculator_form.html" %}
diff --git a/datacenterlight/urls.py b/datacenterlight/urls.py index 2cd0723f..8d6273ef 100644 --- a/datacenterlight/urls.py +++ b/datacenterlight/urls.py @@ -17,8 +17,8 @@ urlpatterns = [ url(r'^l/$', IndexView.as_view(), name='index_l'), url(r'^whydatacenterlight/?$', WhyDataCenterLightView.as_view(), name='whydatacenterlight'), - url(r'^beta-program/?$', BetaProgramView.as_view(), name='beta'), - url(r'^landing/?$', LandingProgramView.as_view(), name='landing'), + # url(r'^beta-program/?$', BetaProgramView.as_view(), name='beta'), + # url(r'^landing/?$', LandingProgramView.as_view(), name='landing'), url(r'^payment/?$', PaymentOrderView.as_view(), name='payment'), url(r'^order-confirmation/?$', OrderConfirmationView.as_view(), name='order_confirmation'), diff --git a/datacenterlight/views.py b/datacenterlight/views.py index fda8c9c9..8a41005f 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -76,6 +76,7 @@ class ContactUsView(FormView): class LandingProgramView(TemplateView): + # FIXME: template doesn't exist template_name = "datacenterlight/landing.html" @@ -143,6 +144,7 @@ class BetaAccessView(FormView): class BetaProgramView(CreateView): + # FIXME: template doesn't exist template_name = "datacenterlight/beta.html" model = BetaAccessVM fields = '__all__' From 24bd5a18809fe1348f4243035cc4b5602c7e6dae Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Mon, 8 Jan 2018 02:33:04 +0530 Subject: [PATCH 0114/1159] navbar closes on click, smooth scroll enabled --- .../static/ungleich_page/js/ungleich.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ungleich_page/static/ungleich_page/js/ungleich.js b/ungleich_page/static/ungleich_page/js/ungleich.js index ca6a71e3..d2121bcb 100644 --- a/ungleich_page/static/ungleich_page/js/ungleich.js +++ b/ungleich_page/static/ungleich_page/js/ungleich.js @@ -15,3 +15,30 @@ function toggleImage(e) { $this.fadeIn(300); }); }; + +/*! + * Start Bootstrap - Agnecy Bootstrap Theme (http://startbootstrap.com) + * Code licensed under the Apache License v2.0. + * For details, see http://www.apache.org/licenses/LICENSE-2.0. + */ + +// jQuery for page scrolling feature - requires jQuery Easing plugin +$(function() { + $('a.page-scroll').bind('click', function(event) { + var $anchor = $(this); + $('html, body').stop().animate({ + scrollTop: $($anchor.attr('href')).offset().top + }, 1500, 'easeInOutExpo'); + event.preventDefault(); + }); +}); + +// Highlight the top nav as scrolling occurs +$('body').scrollspy({ + target: '.navbar-fixed-top' +}) + +// Closes the Responsive Menu on Menu Item Click +$('.navbar-collapse ul li a').click(function() { + $('.navbar-toggle:visible').click(); +}); From 12fe1fa7226cc5a6967bd6e77057b3da6da1606a Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Mon, 8 Jan 2018 02:45:16 +0530 Subject: [PATCH 0115/1159] Update Changelog --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index 010e094f..7e681a75 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,6 @@ Next: * #4000: [all] Replace all ungleich.com with ungleich.ch + * #4067: [ungleich] mobile navbar toggle fix 1.3.1: 2017-12-31 * feature: [all] Load email configurations host, port and use_tls from env * bugfix: [all] Use ungleich's smtp as relayhost for sending emails From 0697492ab8cc2912adbf2fbf7c82855cda988ade Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Mon, 8 Jan 2018 07:36:30 +0530 Subject: [PATCH 0116/1159] removed unused css files --- datacenterlight/templates/datacenterlight/base_hosting.html | 3 --- datacenterlight/templates/datacenterlight/beta_success.html | 1 - dynamicweb/settings/base.py | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/base_hosting.html b/datacenterlight/templates/datacenterlight/base_hosting.html index 613d67a9..848b8a46 100644 --- a/datacenterlight/templates/datacenterlight/base_hosting.html +++ b/datacenterlight/templates/datacenterlight/base_hosting.html @@ -21,10 +21,8 @@ - - {% block css_extra %} {% endblock css_extra %} @@ -49,7 +47,6 @@ - {% block navbar %} {% include "hosting/includes/_navbar_user.html" %} {% endblock navbar %} diff --git a/datacenterlight/templates/datacenterlight/beta_success.html b/datacenterlight/templates/datacenterlight/beta_success.html index 60df607c..7ac49457 100644 --- a/datacenterlight/templates/datacenterlight/beta_success.html +++ b/datacenterlight/templates/datacenterlight/beta_success.html @@ -1,4 +1,3 @@ - {% load i18n %} -
+ {% csrf_token %}
+
{{contact_form.name.errors}}
@@ -30,6 +31,7 @@
+
{{contact_form.email.errors}}
@@ -37,6 +39,7 @@
+
{{contact_form.message.errors}}
diff --git a/datacenterlight/templates/datacenterlight/includes/_navbar.html b/datacenterlight/templates/datacenterlight/includes/_navbar.html index e2f1edc0..2f435704 100644 --- a/datacenterlight/templates/datacenterlight/includes/_navbar.html +++ b/datacenterlight/templates/datacenterlight/includes/_navbar.html @@ -1,6 +1,6 @@ -{% load staticfiles i18n%} -{% load custom_tags %} +{% load staticfiles i18n custom_tags %} {% get_current_language as LANGUAGE_CODE %} +
diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 8a41005f..0e860b7e 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -391,7 +391,6 @@ class PaymentOrderView(FormView): @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): - # user is no longer added to session on the index page if 'specs' not in request.session: return HttpResponseRedirect(reverse('datacenterlight:index')) return self.render_to_response(self.get_context_data()) diff --git a/digitalglarus/templates/new_base_glarus.html b/digitalglarus/templates/new_base_glarus.html index 3b18756d..9a24f269 100644 --- a/digitalglarus/templates/new_base_glarus.html +++ b/digitalglarus/templates/new_base_glarus.html @@ -72,8 +72,8 @@ margin: 0px; color:white; } - - @media only screen and (min-width: 769px){ + + @media only screen and (min-width: 769px){ .dropdown.home-dropdown-mobile { display: none; } @@ -81,14 +81,14 @@ display: block; } } - - + + @media only screen and (max-width: 768px){ .dropdown.home-dropdown-mobile { display: block; - background-color: + background-color: } - + .dropdown.home-dropdown-mobile .dropdown-menu{ display: block; background-color: #0f1221; @@ -104,19 +104,19 @@ .dropdown.home-dropdown { display: none; } - + } - + - +
From 82d4bf8c47d0c908d47878faaf776b6f2dfd46db Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 11 Mar 2018 16:38:51 +0100 Subject: [PATCH 0264/1159] Update Changelog --- Changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 86c56802..aa8df651 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,4 @@ -1.5.1 2018-03-09: +1.5: 2018-03-09 * #3554: [dcl] Remove some more beta access resources (some were left in the earlier release) * #3452: [hosting] Back button management and cache control for hosting views * #3718: [dcl] downtime page From 44e913a7444543e07b86214115d6665012e0e161 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 11 Mar 2018 21:24:24 +0100 Subject: [PATCH 0265/1159] Remove datacentelright_content placeholder conf --- .../templates/datacenterlight/cms/base.html | 2 +- dynamicweb/settings/base.py | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/cms/base.html b/datacenterlight/templates/datacenterlight/cms/base.html index a6123cc3..79bb2bef 100644 --- a/datacenterlight/templates/datacenterlight/cms/base.html +++ b/datacenterlight/templates/datacenterlight/cms/base.html @@ -57,7 +57,7 @@ {% endplaceholder %} - {% placeholder 'datacenterlight_content' %} + {% placeholder 'Datacenterlight Content' %} {% placeholder 'datacenterlight_footer'%} diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 05811384..b0dc42f4 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -352,18 +352,6 @@ CMS_PLACEHOLDER_CONF = { }, ] }, - 'datacenterlight_content': { - 'name': _('Datacenterlight Content'), - 'default_plugins': [ - { - 'plugin_type': 'DCLCalculatorPlugin', - 'values': { - 'heading': 'Heading', - 'content': 'Text' - }, - }, - ] - }, } CMS_PERMISSION = True From 533ff9fed77b9ff887ecf8a2a25f6e09632fbdb4 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 11 Mar 2018 22:03:22 +0100 Subject: [PATCH 0266/1159] Update Changelog --- Changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog b/Changelog index aa8df651..9fc03b04 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +1.5.1: 2018-03-11 + * bgfix: [dcl cms] Remove datacenterlight_content placeholder conf 1.5: 2018-03-09 * #3554: [dcl] Remove some more beta access resources (some were left in the earlier release) * #3452: [hosting] Back button management and cache control for hosting views From 9dfb53f2f4ade1b980ee12100862a25ee43f5d7e Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 11 Mar 2018 22:05:06 +0100 Subject: [PATCH 0267/1159] Improve Changelog --- Changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 9fc03b04..c2d905d0 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,5 @@ 1.5.1: 2018-03-11 - * bgfix: [dcl cms] Remove datacenterlight_content placeholder conf + * bgfix: [dcl cms] Remove datacenterlight_content placeholder conf so that we can create a cms page without calculator 1.5: 2018-03-09 * #3554: [dcl] Remove some more beta access resources (some were left in the earlier release) * #3452: [hosting] Back button management and cache control for hosting views From b9a1882080c61190e91ffee93275d5c95e71e31c Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Tue, 13 Mar 2018 01:52:54 +0530 Subject: [PATCH 0268/1159] fix style issues for dcl plugins --- .../datacenterlight/css/landing-page.css | 73 ++----- .../datacenterlight/cms/banner_list.html | 8 +- .../datacenterlight/cms/calculator.html | 18 +- .../datacenterlight/cms/contact.html | 28 ++- .../datacenterlight/cms/navbar_dropdown.html | 2 +- .../datacenterlight/cms/section.html | 51 +++-- .../datacenterlight/whydatacenterlight.html | 190 +++++++++--------- 7 files changed, 176 insertions(+), 194 deletions(-) diff --git a/datacenterlight/static/datacenterlight/css/landing-page.css b/datacenterlight/static/datacenterlight/css/landing-page.css index 61128e69..05b2f075 100755 --- a/datacenterlight/static/datacenterlight/css/landing-page.css +++ b/datacenterlight/static/datacenterlight/css/landing-page.css @@ -501,10 +501,15 @@ textarea { .split-section-plain .split-figure { width: 41.66666667%; } - + .split-section-plain .split-figure.col-sm-push-6 { + left: 58.33333333%; + } .split-section-plain .split-text { width: 58.33333333%; } + .split-section-plain .split-text.col-sm-pull-6 { + right: 41.66666667%; + } } .section-image img { @@ -726,34 +731,10 @@ textarea { width: 70%; } -hr.thick-divider { - border-top: 3px solid #eee !important; -} - .space { padding: 50px 0; -} - -tech-sub-sec h2 { - font-size: 45px; - line-height: 60px; - padding-bottom: 25px; - color: #3a3a3a; - letter-spacing: 1px; -} - -.logo-wrap { - text-align: center; - min-height: 140px; - padding: 20px 40px 30px 40px; -} - -.btm-space { - padding-bottom: 8px; -} - -.btm-space-tayga { - padding-bottom: 12px; + max-width: 660px; + margin: auto; } .percent-text { @@ -761,11 +742,6 @@ tech-sub-sec h2 { color: #999; } -.tech-sub-sec h2 { - font-size: 40px; - line-height: 55px; -} - .space-middle { /* padding: 45px 0; */ display: inline-block; @@ -791,16 +767,6 @@ tech-sub-sec h2 { padding: 30px 2px 20px; } -.logo-wrap .logo-caption { - padding-top: 20px; - display: inline-block; - color: #999 !important; -} - -.logo-wrap-1 { - padding-top: 50px; -} - /*Pricing page*/ @@ -966,13 +932,6 @@ tech-sub-sec h2 { } } -@media (min-width: 576px) and (max-width: 767px) { - .logo-wrap, .logo-wrap-1 { - width: 50%; - padding: 15px 30px !important; - min-height: 179px; - } -} @media(max-width:991px) { .section-sm-center .split-text { @@ -989,9 +948,6 @@ tech-sub-sec h2 { } @media(max-width:767px) { - .logo-wrap { - padding: 10px; - } .navbar-transparent li a { color: #777 !important; } @@ -1138,9 +1094,6 @@ tech-sub-sec h2 { } @media(max-width:575px) { - .logo-wrap { - padding: 30px; - } .percent-text { font-weight: normal; font-size: 37px; @@ -1210,12 +1163,16 @@ footer { flex-shrink: 0; padding: 0 15px; } + .flex-row .desc-text { + text-align: right; + } .flex-row .desc-text, .flex-row .percent-text { - max-width: 380px; + max-width: 430px; } .flex-row-rev .desc-text { max-width: 710px; + text-align: left; } .flex-row-rev .percent-text { order: 2; @@ -1225,10 +1182,6 @@ footer { } } -.w380 { - max-width: 380px !important; -} - .checkmark { display: inline-block; } diff --git a/datacenterlight/templates/datacenterlight/cms/banner_list.html b/datacenterlight/templates/datacenterlight/cms/banner_list.html index 7ef1c1c5..92c5c059 100644 --- a/datacenterlight/templates/datacenterlight/cms/banner_list.html +++ b/datacenterlight/templates/datacenterlight/cms/banner_list.html @@ -2,9 +2,11 @@