Fix issue #60 verification code generation
This commit is contained in:
+1
-1
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user