mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-13 05:49:07 +00:00
perf: 优化系统用户生成密码的复杂度 (#5648)
* perf: 优化系统用户生成密码的复杂度 * perf: 修改 common.random_string Co-authored-by: ibuler <ibuler@qq.com> Co-authored-by: Bai <bugatti_it@163.com>
This commit is contained in:
@@ -18,7 +18,7 @@ from django.shortcuts import reverse
|
||||
|
||||
from orgs.utils import current_org
|
||||
from orgs.models import OrganizationMember, Organization
|
||||
from common.utils import date_expired_default, get_logger, lazyproperty
|
||||
from common.utils import date_expired_default, get_logger, lazyproperty, random_string
|
||||
from common import fields
|
||||
from common.const import choices
|
||||
from common.db.models import ChoiceSet
|
||||
@@ -387,7 +387,7 @@ class TokenMixin:
|
||||
cache_key = '%s_%s' % (self.id, remote_addr)
|
||||
token = cache.get(cache_key)
|
||||
if not token:
|
||||
token = uuid.uuid4().hex
|
||||
token = random_string(36)
|
||||
cache.set(token, self.id, expiration)
|
||||
cache.set('%s_%s' % (self.id, remote_addr), token, expiration)
|
||||
date_expired = timezone.now() + timezone.timedelta(seconds=expiration)
|
||||
|
Reference in New Issue
Block a user