fix: 修复 random error

pull/11665/head
ibuler 2023-09-19 17:02:08 +08:00 committed by Bryan
parent 6c9c64a55f
commit 4009457000
2 changed files with 3 additions and 6 deletions

View File

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
#
import struct
import random
import socket
import string
import struct
string_punctuation = '!#$%&()*+,-.:;<=>?@[]^_~'
@ -19,6 +18,7 @@ def random_ip():
def random_string(length: int, lower=True, upper=True, digit=True, special_char=False):
random.seed(None)
args_names = ['lower', 'upper', 'digit', 'special_char']
args_values = [lower, upper, digit, special_char]
args_string = [string.ascii_lowercase, string.ascii_uppercase, string.digits, string_punctuation]

View File

@ -3,8 +3,6 @@
#
import base64
import datetime
import random
import string
import uuid
from typing import Callable
@ -562,8 +560,7 @@ class TokenMixin:
return self.access_keys.first()
def generate_reset_token(self):
letter = string.ascii_letters + string.digits
token = ''.join([random.choice(letter) for _ in range(50)])
token = random_string(50)
self.set_cache(token)
return token