core: Add Token identifier as sudo-primary key

This commit is contained in:
Jens Langhammer
2020-10-03 23:37:58 +02:00
parent b590589324
commit c5a6b4961f
8 changed files with 231 additions and 3 deletions

View File

@ -8,7 +8,7 @@ from django.utils.timezone import now
from django.utils.translation import gettext as _
from structlog import get_logger
from passbook.core.models import Token, User
from passbook.core.models import Token, TokenIntents, User
from passbook.lib.config import CONFIG
LOGGER = get_logger()
@ -47,6 +47,8 @@ class Command(BaseCommand):
token = Token.objects.create(
expires=expiry,
user=user,
identifier="recovery",
intent=TokenIntents.INTENT_RECOVERY,
description=f"Recovery Token generated by {getuser()} on {_now}",
)
self.stdout.write(