diff --git a/backend/accounts/utils.py b/backend/accounts/utils.py index d5e083c..609046c 100644 --- a/backend/accounts/utils.py +++ b/backend/accounts/utils.py @@ -9,7 +9,8 @@ from django.core.mail import EmailMultiAlternatives from django.utils.html import format_html from backend.core.utils import generate_first_page_image from email.mime.image import MIMEImage - +from django.conf import settings +site_domain = settings.SITE_DOMAIN def send_confirmation_email(email): confirmation, created = EmailConfirmation.objects.get_or_create(email=email) @@ -19,7 +20,7 @@ def send_confirmation_email(email): confirmation.created_at = now() confirmation.save() - confirmation_link = f"http://127.0.0.1:8000{reverse('confirm_email', args=[confirmation.uuid])}" + confirmation_link = f"{site_domain}{reverse('confirm_email', args=[confirmation.uuid])}" send_mail( subject="Confirm your e-mail address", @@ -32,7 +33,7 @@ def send_payment_email(email): organization = Organization.objects.get(email=email) document = Document.objects.get(organization=organization) - payment_link = f"http://127.0.0.1:8000{reverse('core:payment_page')}?email={email}" + payment_link = f"{site_domain}{reverse('core:payment_page')}?email={email}" send_mail( subject="Complete your payment", diff --git a/backend/core/models.py b/backend/core/models.py index 6dc5587..6c42916 100644 --- a/backend/core/models.py +++ b/backend/core/models.py @@ -44,8 +44,8 @@ class CreatedBy(models.Model): class Organization(models.Model): - name = models.CharField(max_length=255, help_text="What is the name of your organization?") - email = models.EmailField(help_text="What is your email?") + name = models.CharField(max_length=255, unique=True, help_text="What is the name of your organization?") + email = models.EmailField(unique=True, help_text="What is your email?") employee_headcount = models.CharField(max_length=20, help_text="What is your organization's current employee headcount?") annual_revenue = models.CharField(max_length=20, help_text="What is your organization's annual revenue range?") critical_applications = models.CharField(max_length=20, help_text="How many critical business applications do your employees use daily?") diff --git a/backend/core/views.py b/backend/core/views.py index 3f6350e..94cf41e 100644 --- a/backend/core/views.py +++ b/backend/core/views.py @@ -8,6 +8,8 @@ from backend.accounts.utils import send_confirmation_email, send_document_email from django.contrib.admin.views.decorators import staff_member_required from django.template import Template, Context from .utils import generate_pdf +from django.conf import settings +site_domain = settings.SITE_DOMAIN @@ -110,7 +112,7 @@ def payment_page(request): document = get_object_or_404(Document, organization=organization) if request.method == "POST": - pdf_url = f"http://127.0.0.1:8000/pdf/{document.id}" + pdf_url = f"{site_domain}/document/{document.id}/" send_document_email(email, pdf_url, document) return redirect(pdf_url) diff --git a/backend/settings.py b/backend/settings.py index fee0daf..1b5c616 100644 --- a/backend/settings.py +++ b/backend/settings.py @@ -37,6 +37,7 @@ DEBUG = config('DEBUG', default=False, cast=bool) ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=[], cast=Csv()) +SITE_DOMAIN = "http://64.226.105.114" # Application definition