Merge pull request #11622 from jumpserver/pr@dev@perf_random_error

fix: 修复 random error
pull/11609/head
老广 2023-09-19 18:15:50 +08:00 committed by GitHub
commit 74cc174d7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -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]

View File

@ -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