From 104fc37bde405689e55571ac1d4a3ba6fbf721e4 Mon Sep 17 00:00:00 2001 From: Levi Date: Tue, 21 Jun 2016 00:10:38 -0500 Subject: [PATCH] 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 --- email_cron | 3 - hosting/forms.py | 8 +- hosting/static/hosting/css/landing-page.css | 6 ++ .../emails/password_reset_email.html | 13 +++ .../templates/emails/password_reset_email.txt | 13 +++ hosting/templates/hosting/base_short.html | 2 +- .../hosting/confirm_reset_password.html | 38 +++++++++ hosting/templates/hosting/login.html | 10 +++ hosting/templates/hosting/reset_password.html | 29 +++++++ hosting/templates/hosting/signup.html | 4 +- hosting/urls.py | 5 +- hosting/views.py | 81 ++++++++++++++++--- utils/forms.py | 43 ++++++++++ 13 files changed, 235 insertions(+), 20 deletions(-) delete mode 100644 email_cron create mode 100644 hosting/templates/emails/password_reset_email.html create mode 100644 hosting/templates/emails/password_reset_email.txt create mode 100644 hosting/templates/hosting/confirm_reset_password.html create mode 100644 hosting/templates/hosting/reset_password.html diff --git a/email_cron b/email_cron deleted file mode 100644 index 559fd565..00000000 --- a/email_cron +++ /dev/null @@ -1,3 +0,0 @@ -* * * * * (cd /home/app/app/; /usr/bin/python3 manage.py send_mail) -0,20,40 * * * * (cd /home/app/app/; /usr/bin/python3 manage.py retry_deferred) -0 0 * * * (cd /home/app/app/; /usr/bin/python3 manage.py purge_mail_log 7) \ No newline at end of file diff --git a/hosting/forms.py b/hosting/forms.py index c6537355..8007b2f4 100644 --- a/hosting/forms.py +++ b/hosting/forms.py @@ -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 diff --git a/hosting/static/hosting/css/landing-page.css b/hosting/static/hosting/css/landing-page.css index fc0b98f2..166a8241 100644 --- a/hosting/static/hosting/css/landing-page.css +++ b/hosting/static/hosting/css/landing-page.css @@ -83,6 +83,12 @@ h6 { height: 100%; } +.intro-reset-password { + background: url(../img/signup-bg.png) no-repeat center center; + background-size: cover; + height: 100%; +} + .intro-message > h1 { margin: 0; font-weight: 400; diff --git a/hosting/templates/emails/password_reset_email.html b/hosting/templates/emails/password_reset_email.html new file mode 100644 index 00000000..682834f5 --- /dev/null +++ b/hosting/templates/emails/password_reset_email.html @@ -0,0 +1,13 @@ +{% load i18n %}{% autoescape off %} +{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} + +{% trans "Please go to the following page and choose a new password:" %} + {% block reset_link %} + {{ base_url }}{% url 'hosting:reset_password_confirm' uidb64=uid token=token %} + {% endblock %} + +{% trans "Thanks for using our site!" %} + +{% blocktrans %}The {{ site_name }} team{% endblocktrans %} + +{% endautoescape %} \ No newline at end of file diff --git a/hosting/templates/emails/password_reset_email.txt b/hosting/templates/emails/password_reset_email.txt new file mode 100644 index 00000000..682834f5 --- /dev/null +++ b/hosting/templates/emails/password_reset_email.txt @@ -0,0 +1,13 @@ +{% load i18n %}{% autoescape off %} +{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} + +{% trans "Please go to the following page and choose a new password:" %} + {% block reset_link %} + {{ base_url }}{% url 'hosting:reset_password_confirm' uidb64=uid token=token %} + {% endblock %} + +{% trans "Thanks for using our site!" %} + +{% blocktrans %}The {{ site_name }} team{% endblocktrans %} + +{% endautoescape %} \ No newline at end of file diff --git a/hosting/templates/hosting/base_short.html b/hosting/templates/hosting/base_short.html index 5c6110c5..5f0604a7 100644 --- a/hosting/templates/hosting/base_short.html +++ b/hosting/templates/hosting/base_short.html @@ -53,7 +53,7 @@ - +