mirror of https://github.com/jumpserver/jumpserver
Merge pull request #11622 from jumpserver/pr@dev@perf_random_error
fix: 修复 random errorpull/11609/head
commit
74cc174d7a
|
@ -18,6 +18,7 @@ def random_ip():
|
|||
|
||||
|
||||
def random_string(length: int, lower=True, upper=True, digit=True, special_char=False, symbols=string_punctuation):
|
||||
random.seed()
|
||||
args_names = ['lower', 'upper', 'digit']
|
||||
args_values = [lower, upper, digit]
|
||||
args_string = [string.ascii_lowercase, string.ascii_uppercase, string.digits]
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
#
|
||||
import base64
|
||||
import datetime
|
||||
import random
|
||||
import string
|
||||
import uuid
|
||||
from typing import Callable
|
||||
|
||||
|
@ -607,8 +605,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
|
||||
|
||||
|
|
Loading…
Reference in New Issue