Fix issue #60 verification code generation

This commit is contained in:
2026-04-30 07:39:14 +02:00
parent 297b319a20
commit 033c52a365
+1 -1
View File
@@ -46,7 +46,7 @@ class VerificationCode(models.Model):
def generate(user: User, code_mode: str) -> VerificationCode: def generate(user: User, code_mode: str) -> VerificationCode:
while True: while True:
code = "".join(random.choices(string.ascii_letters+string.digits+string.punctuation)) code = "".join(random.choices(string.ascii_letters+string.digits+string.punctuation, k=64))
if not VerificationCode.objects.filter(code=code).exists(): if not VerificationCode.objects.filter(code=code).exists():
return VerificationCode.objects.create( return VerificationCode.objects.create(
code = code, code = code,