Adds email confirmation code field

This commit is contained in:
Mouse Reeve
2021-08-06 14:42:18 -07:00
parent 1126f47224
commit 3e2f1806e9
4 changed files with 62 additions and 9 deletions

View File

@ -1,4 +1,6 @@
""" base model with default fields """
import base64
from Crypto import Random
from django.db import models
from django.dispatch import receiver
@ -9,6 +11,7 @@ from .fields import RemoteIdField
DeactivationReason = models.TextChoices(
"DeactivationReason",
[
"pending",
"self_deletion",
"moderator_deletion",
"domain_block",
@ -16,6 +19,11 @@ DeactivationReason = models.TextChoices(
)
def new_access_code():
"""the identifier for a user invite"""
return base64.b32encode(Random.get_random_bytes(5)).decode("ascii")
class BookWyrmModel(models.Model):
"""shared fields"""