diff --git a/Changelog b/Changelog index 11d2443f..cb3d23fa 100644 --- a/Changelog +++ b/Changelog @@ -1,10 +1,22 @@ -Next Release +Next release: + * Bugfix: [dcl, hosting] Fix Stripe js error in confirm payment page + * #3847: [ungleich] change text 'hosting products' -> 'our products' + * #3829: [dcl] Handle landing login fail in payment page itself + * #3794: [dcl, hosting] Update email styles + * #3828: [dcl, hosting] invoice period set to show monthly subscription + * #3838: [hosting] restyle signup/login/password reset/password pages +1.2.6: 2017-10-10 + * Bugfix: [dcl] Refactor and optimize images, links in glasfaser page + * Bugfix: [dcl] Fix email not being sent issue +1.2.5: 2017-10-10 * #3785: [hosting] update 'my bills' page design * Bugfix: [hosting] card details input form alignment fix * #3823: [hosting] favicon link fixed + * #3844: [dcl] Add Glasfaser page for advertisement + 1.2.4: 2017-10-02 * #3780: [hosting] Store VM details locally - * #3764: [hosting] Show cancelled VMs' invoices + * #3764: [hosting] Show cancelled VMs' invoices * #3736: [dcl] Refactor the place where we compute the VM price * #3730: [dcl] Refactor price parameter passed in the DCL flow * #3807: [dcl] Remove PricingView as it is no more used @@ -16,7 +28,7 @@ Next Release * #3808: [dcl] Order confirmation page redesign 1.2.3: 2017-09-25 * #3484: [dcl, hosting] Refactored account activation, password reset, VM order and cancellation email - * #3731: [dcl, hosting] Added cdist ssh key handler + * #3731: [dcl, hosting] Added cdist ssh key handler * #3628: [dcl] on hosting, VM is created at credit card info submit * #3772: [dcl] Updated hosting app billing into monthly subscription and added new text and translations * #3786: [hosting] Redesigned the hosting invoice and order-confirmation page @@ -47,8 +59,8 @@ Next Release * #3765: [hosting] Text fix Your SSH Keys to My SSH Keys * #3639: [datacenterlight] Added navbar menu after payment page on landing * #3735: [hosting] Increased modal width and modal button width - * #3709: Activated Text Plugin by default for the Page Title Text, enabled
+ + | +
+ {% trans "Data Center Light Account Activation" %}+ |
+
+ + {% blocktrans %}You can activate your Data Center Light account by clicking here.{% endblocktrans %} + ++ {% blocktrans %}You can also copy and paste the following link into the address bar of your browser to activate your Data Center Light account.{% endblocktrans %} + ++ {{base_url}}{{activation_link}} + ++ {% if account_details %} + {% url 'hosting:reset_password' as reset_password_url %} + {% trans "Your account details are as follows" %}: + + {% trans "Username" %} : {% trans "Your email address" %} + {% trans "Password" %} : {{account_details}} + + {% trans "You can reset your password here" %}: + {{base_url}}{{reset_password_url}} + {% endif %} + + |
+
+ {% trans "Your Data Center Light Team" %}+ |
+
+ + | +
+ {% trans "Welcome to Data Center Light!" %}+ |
+
+ + {% blocktrans %}Thanks for joining us! We provide the most affordable virtual machines from the heart of Switzerland.{% endblocktrans %} + ++ {% blocktrans %}Try now, order a VM. VM price starts from only 15CHF per month.{% endblocktrans %} + + |
+
+ {% trans "ORDER VM" %} + | +
+ {% trans "Your Data Center Light Team" %}+ |
+
{% blocktrans %}Already signed up?
By logging in you can retrieve saved billing information.{% endblocktrans %}
@@ -58,7 +59,7 @@ {% endfor %}
diff --git a/datacenterlight/urls.py b/datacenterlight/urls.py index a8d8f49d..2cd0723f 100644 --- a/datacenterlight/urls.py +++ b/datacenterlight/urls.py @@ -1,9 +1,13 @@ from django.conf.urls import url -from .views import IndexView, BetaProgramView, LandingProgramView, \ - BetaAccessView, SuccessView, \ - PaymentOrderView, OrderConfirmationView, \ +from .views import ( + IndexView, BetaProgramView, LandingProgramView, BetaAccessView, + SuccessView, PaymentOrderView, OrderConfirmationView, WhyDataCenterLightView, ContactUsView +) + +from django.views.generic import TemplateView + urlpatterns = [ url(r'^$', IndexView.as_view(), name='index'), @@ -21,4 +25,8 @@ urlpatterns = [ url(r'^order-success/?$', SuccessView.as_view(), name='order_success'), url(r'^beta_access?$', BetaAccessView.as_view(), name='beta_access'), url(r'^contact/?$', ContactUsView.as_view(), name='contact_us'), + + url(r'glasfaser/?$', + TemplateView.as_view(template_name='ungleich_page/glasfaser.html'), + name='glasfaser'), ] diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 40544fef..bd1a7f51 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -49,13 +49,17 @@ class ContactUsView(FormView): def form_valid(self, form): form.save() + from_emails = { + 'glasfaser': 'glasfaser@ungleich.ch' + } + from_page = self.request.POST.get('from_page') email_data = { 'subject': "{dcl_text} Message from {sender}".format( dcl_text=settings.DCL_TEXT, sender=form.cleaned_data.get('email') ), 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS, - 'to': ['info@ungleich.ch'], + 'to': [from_emails.get(from_page, 'info@ungleich.ch')], 'body': "\n".join( ["%s=%s" % (k, v) for (k, v) in form.cleaned_data.items()]), 'reply_to': [form.cleaned_data.get('email')], @@ -341,26 +345,45 @@ class PaymentOrderView(FormView): else: return BillingAddressFormSignup - def get_form_kwargs(self): - form_kwargs = super(PaymentOrderView, self).get_form_kwargs() - # if user is signed in, get billing address - if self.request.user.is_authenticated(): - form_kwargs.update({ - 'instance': self.request.user.billing_addresses.first() - }) - if 'billing_address_data' in self.request.session: - billing_address_data = self.request.session['billing_address_data'] - form_kwargs.update({ - 'initial': billing_address_data - }) - return form_kwargs - def get_context_data(self, **kwargs): context = super(PaymentOrderView, self).get_context_data(**kwargs) + if 'billing_address_data' in self.request.session: + billing_address_data = self.request.session['billing_address_data'] + else: + billing_address_data = {} + + if self.request.user.is_authenticated(): + if billing_address_data: + billing_address_form = BillingAddressForm( + initial=billing_address_data + ) + else: + billing_address_form = BillingAddressForm( + instance=self.request.user.billing_addresses.first() + ) + # Get user last order + last_hosting_order = HostingOrder.objects.filter( + customer__user=self.request.user + ).last() + + # If user has already an hosting order, get the credit card + # data from it + if last_hosting_order: + credit_card_data = last_hosting_order.get_cc_data() + if credit_card_data: + context['credit_card_data'] = credit_card_data + else: + context['credit_card_data'] = None + else: + billing_address_form = BillingAddressFormSignup( + initial=billing_address_data + ) + context.update({ 'stripe_key': settings.STRIPE_API_PUBLIC_KEY, 'site_url': reverse('datacenterlight:index'), - 'login_form': HostingUserLoginForm() + 'login_form': HostingUserLoginForm(prefix='login_form'), + 'billing_address_form': billing_address_form }) return context @@ -372,9 +395,32 @@ class PaymentOrderView(FormView): return self.render_to_response(self.get_context_data()) def post(self, request, *args, **kwargs): - form = self.get_form() - if form.is_valid(): - token = form.cleaned_data.get('token') + if 'login_form' in request.POST: + login_form = HostingUserLoginForm(data=request.POST, + prefix='login_form') + if login_form.is_valid(): + email = login_form.cleaned_data.get('email') + password = login_form.cleaned_data.get('password') + auth_user = authenticate(email=email, password=password) + if auth_user: + login(self.request, auth_user) + return HttpResponseRedirect( + reverse('datacenterlight:payment') + ) + else: + context = self.get_context_data() + context['login_form'] = login_form + return self.render_to_response(context) + if request.user.is_authenticated(): + address_form = BillingAddressForm( + data=request.POST, + ) + else: + address_form = BillingAddressFormSignup( + data=request.POST, + ) + if address_form.is_valid(): + token = address_form.cleaned_data.get('token') if request.user.is_authenticated(): this_user = { 'email': request.user.email, @@ -384,8 +430,8 @@ class PaymentOrderView(FormView): email=this_user.get('email'), token=token) else: - user_email = form.cleaned_data.get('email') - user_name = form.cleaned_data.get('name') + user_email = address_form.cleaned_data.get('email') + user_name = address_form.cleaned_data.get('name') this_user = { 'email': user_email, 'name': user_name @@ -418,13 +464,18 @@ class PaymentOrderView(FormView): token=token, customer_name=user_name) - request.session['billing_address_data'] = form.cleaned_data + request.session['billing_address_data'] = address_form.cleaned_data request.session['user'] = this_user # Get or create stripe customer if not customer: - form.add_error("__all__", "Invalid credit card") + address_form.add_error( + "__all__", "Invalid credit card" + ) return self.render_to_response( - self.get_context_data(form=form)) + self.get_context_data( + billing_address_form=address_form + ) + ) request.session['token'] = token if type(customer) is StripeCustomer: request.session['customer'] = customer.stripe_id @@ -433,7 +484,9 @@ class PaymentOrderView(FormView): return HttpResponseRedirect( reverse('datacenterlight:order_confirmation')) else: - return self.form_invalid(form) + context = self.get_context_data() + context['billing_address_form'] = address_form + return self.render_to_response(context) class OrderConfirmationView(DetailView): @@ -544,9 +597,13 @@ class OrderConfirmationView(DetailView): try: custom_user = CustomUser.objects.get( email=user.get('email')) - customer = StripeCustomer.objects.filter( + stripe_customer = StripeCustomer.objects.filter( user_id=custom_user.id).first() - stripe_customer_id = customer.id + if stripe_customer is None: + stripe_customer = StripeCustomer.objects.create( + user=custom_user, stripe_id=stripe_api_cus_id + ) + stripe_customer_id = stripe_customer.id except CustomUser.DoesNotExist: logger.debug( "Customer {} does not exist.".format(user.get('email'))) diff --git a/digitalglarus/locale/de/LC_MESSAGES/django.po b/digitalglarus/locale/de/LC_MESSAGES/django.po index f4193749..6ae6a6bb 100644 --- a/digitalglarus/locale/de/LC_MESSAGES/django.po +++ b/digitalglarus/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-07-16 17:50+0000\n" +"POT-Creation-Date: 2017-10-10 21:35+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME