Konflikt resen
This commit is contained in:
@@ -2,6 +2,7 @@ from celery import shared_task
|
||||
from backend.core.models import Organization, Document, Risk, Control, DocumentRiskControl
|
||||
from backend.core.utils import get_top_risk, get_controls_for_risk
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from .utils import send_payment_email
|
||||
|
||||
|
||||
@shared_task
|
||||
@@ -49,4 +50,7 @@ def create_document_for_organization(confirmation_email):
|
||||
|
||||
controls_content += "\n"
|
||||
|
||||
document.add_segment('body', controls_content)
|
||||
document.add_segment('body', controls_content)
|
||||
|
||||
|
||||
send_payment_email(confirmation_email)
|
||||
@@ -1,8 +1,10 @@
|
||||
{% extends "base_login.html" %}
|
||||
|
||||
{% extends "base.html" %}
|
||||
|
||||
{%block content%}
|
||||
<h2>Link has expired! </h2>
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
<button type="submit">Resend link</button>
|
||||
</form>
|
||||
|
||||
</form>
|
||||
{% endblock %}
|
||||
@@ -1,5 +1,11 @@
|
||||
{% extends "base_login.html" %}
|
||||
{% extends "base.html" %}
|
||||
|
||||
{%block content%}
|
||||
<div class="out-risk-management">
|
||||
<div class="risk-management">
|
||||
<h1>Email Confirmed!</h1>
|
||||
<p>Your email {{ email }} has been successfully verified.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h1>Email Confirmed!</h1>
|
||||
<p>Your email {{ email }} has been successfully verified.</p>
|
||||
{%endblock%}
|
||||
|
||||
@@ -4,7 +4,7 @@ from .models import EmailConfirmation
|
||||
import uuid
|
||||
from django.conf import settings
|
||||
from django.utils.timezone import now
|
||||
|
||||
from backend.core.models import Document, Organization
|
||||
|
||||
def send_confirmation_email(email):
|
||||
confirmation, created = EmailConfirmation.objects.get_or_create(email=email)
|
||||
@@ -21,4 +21,28 @@ def send_confirmation_email(email):
|
||||
message=f"Please click on the link to confirm your e-mail address: {confirmation_link}",
|
||||
from_email= settings.EMAIL_HOST_USER,
|
||||
recipient_list=[email]
|
||||
)
|
||||
)
|
||||
|
||||
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}"
|
||||
|
||||
send_mail(
|
||||
subject="Complete your payment",
|
||||
message=f"Click the link to proceed with payment: {payment_link}",
|
||||
from_email=settings.EMAIL_HOST_USER,
|
||||
recipient_list=[email],
|
||||
fail_silently=False,
|
||||
)
|
||||
|
||||
def send_document_email(email, document_link):
|
||||
send_mail(
|
||||
subject="Your Document is Ready",
|
||||
message=f"You can access your document at any time here: {document_link}",
|
||||
from_email=settings.EMAIL_HOST_USER,
|
||||
recipient_list=[email],
|
||||
fail_silently=False,
|
||||
)
|
||||
|
||||
|
||||
@@ -17,13 +17,10 @@ def confirm_email(request, uuid):
|
||||
confirmation = get_object_or_404(EmailConfirmation, uuid=uuid)
|
||||
|
||||
if confirmation.is_expired():
|
||||
return render(request, 'confirmation_expired.html', {'email': confirmation.email})
|
||||
return render(request, 'accounts/confirmation_expired.html', {'email': confirmation.email})
|
||||
|
||||
task = create_document_for_organization.delay(confirmation.email)
|
||||
print(f"Task ID: {task.id}")
|
||||
|
||||
|
||||
return HttpResponse("Email is confirmed")
|
||||
return render(request, 'accounts/confirmation_success.html', {'email': confirmation.email})
|
||||
|
||||
def resend_confirmation(request,email):
|
||||
if request.method == 'POST':
|
||||
|
||||
Reference in New Issue
Block a user