Merge pull request #54 from levivm/feature/vm_pricing
Added redirect urls after signup/login
This commit is contained in:
commit
03ec41b8e2
2 changed files with 14 additions and 9 deletions
|
@ -16,5 +16,6 @@ class ProcessVMSelectionMixin(object):
|
|||
request.session['vm_specs'] = vm_specs
|
||||
if not request.user.is_authenticated():
|
||||
request.session['vm_specs'] = vm_specs
|
||||
request.session['next'] = reverse('hosting:payment')
|
||||
return redirect(reverse('hosting:login'))
|
||||
return redirect(reverse('hosting:payment'))
|
||||
|
|
|
@ -110,13 +110,16 @@ class LoginView(FormView):
|
|||
form_class = HostingUserLoginForm
|
||||
moodel = CustomUser
|
||||
|
||||
def get_success_url(self):
|
||||
next_url = self.request.session.get('next', self.success_url)
|
||||
return next_url
|
||||
|
||||
def form_valid(self, form):
|
||||
email = form.cleaned_data.get('email')
|
||||
password = form.cleaned_data.get('password')
|
||||
auth_user = authenticate(email=email, password=password)
|
||||
|
||||
if auth_user:
|
||||
|
||||
login(self.request, auth_user)
|
||||
return HttpResponseRedirect(self.get_success_url())
|
||||
|
||||
|
@ -129,7 +132,8 @@ class SignupView(CreateView):
|
|||
moodel = CustomUser
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse_lazy('hosting:signup')
|
||||
next_url = self.request.session.get('next', reverse_lazy('hosting:signup'))
|
||||
return next_url
|
||||
|
||||
def form_valid(self, form):
|
||||
|
||||
|
@ -217,6 +221,7 @@ class PaymentVMView(FormView):
|
|||
else:
|
||||
return self.form_invalid(form)
|
||||
|
||||
|
||||
class InvoiceVMView(LoginRequiredMixin, View):
|
||||
template_name = "hosting/invoice.html"
|
||||
login_url = reverse_lazy('hosting:login')
|
||||
|
@ -242,7 +247,6 @@ class InvoiceVMView(LoginRequiredMixin, View):
|
|||
}
|
||||
return context
|
||||
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
||||
context = self.get_context_data()
|
||||
|
|
Loading…
Reference in a new issue