From 16b6ecb38cdc87737c54e9f51e3ffa7eff51014a Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 29 Oct 2017 23:48:33 +0100 Subject: [PATCH] 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):