aboutsummaryrefslogtreecommitdiffstats
path: root/alphabetlearning/payments/models.py
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-12-04 17:11:55 +0000
committerMatthew Lemon <y@yulqen.org>2024-12-04 17:11:55 +0000
commit7cd2fd2b75bc5597e9b2a128bf61201910be6df2 (patch)
tree411c26f821129f196b2a38863a34b05e4e8388e9 /alphabetlearning/payments/models.py
parent4b21e3889e8337fa5bc9e58cdfc61a9f2019adc9 (diff)
Email verification
- Associated changes in the .env file now allow us to test the SMTP server config - Added mine and J's email ad admins - Grab env variables from the .env file in the local.py file for testing purposes - Set an expiry of 24hrs for the validation link to work - Added an HTML version of the verification email
Diffstat (limited to 'alphabetlearning/payments/models.py')
-rw-r--r--alphabetlearning/payments/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/alphabetlearning/payments/models.py b/alphabetlearning/payments/models.py
index ce5c8aa..9ea9de2 100644
--- a/alphabetlearning/payments/models.py
+++ b/alphabetlearning/payments/models.py
@@ -1,8 +1,10 @@
import uuid
+from datetime import timedelta
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
+from django.utils import timezone
from alphabetlearning.resources.models import Resource
@@ -13,6 +15,11 @@ class EmailVerification(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
is_verified = models.BooleanField(default=False)
+ @property
+ def is_expired(self):
+ expiration_time = timedelta(hours=26)
+ return timezone.now() - self.created_at > expiration_time
+
def __str__(self):
return f"Email verification for {self.email}"