|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
from django.db import models |
|
|
|
|
from django.contrib.auth.hashers import make_password |
|
|
|
|
from django.contrib.auth.models import User |
|
|
|
|
|
|
|
|
|
# Basic DB to correlate tokens, users and creation time |
|
|
|
|
|
|
|
|
@ -13,3 +15,18 @@ class ResetToken(models.Model):
|
|
|
|
|
# creation time in epoch (UTC) |
|
|
|
|
# BigInt just so we are save for the next few decades ;) |
|
|
|
|
creation = models.BigIntegerField() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_validation_slug(): |
|
|
|
|
return make_password(None) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UserAccountValidationDetail(models.Model): |
|
|
|
|
user = models.OneToOneField(User, on_delete=models.CASCADE) |
|
|
|
|
VALIDATED_CHOICES = ((0, 'Not validated'), (1, 'Validated')) |
|
|
|
|
validated = models.IntegerField(choices=VALIDATED_CHOICES, default=0) |
|
|
|
|
validation_slug = models.CharField( |
|
|
|
|
db_index=True, unique=True, max_length=50, |
|
|
|
|
default=get_validation_slug |
|
|
|
|
) |
|
|
|
|
date_validation_started = models.DateTimeField(auto_now_add=True) |
|
|
|
|