Created reset password email, Added forgot password view, Added forgot password form, Added set new password form, Added set new password view, fixed signup response issue, fixed main menu ungleich button redirect to django-hosting

This commit is contained in:
Levi 2016-06-21 00:10:38 -05:00
commit d8150b6593
13 changed files with 235 additions and 20 deletions

View file

@ -4,7 +4,7 @@ from django.contrib.auth import authenticate
from utils.stripe_utils import StripeUtils
from .models import HostingOrder
from .models import HostingOrder, VirtualMachinePlan
class HostingOrderAdminForm(forms.ModelForm):
@ -17,6 +17,10 @@ class HostingOrderAdminForm(forms.ModelForm):
customer = self.cleaned_data.get('customer')
vm_plan = self.cleaned_data.get('vm_plan')
if vm_plan.status == VirtualMachinePlan.CANCELED_STATUS:
raise forms.ValidationError("""You can't make a charge over
a canceled virtual machine plan""")
# Make a charge to the customer
stripe_utils = StripeUtils()
charge_response = stripe_utils.make_charge(customer=customer.stripe_id,
@ -53,7 +57,7 @@ class HostingUserLoginForm(forms.Form):
CustomUser.objects.get(email=email)
return email
except CustomUser.DoesNotExist:
raise forms.ValidationError("User does not exists")
raise forms.ValidationError("User does not exist")
else:
return email