diff --git a/apps/authentication/api/connection_token.py b/apps/authentication/api/connection_token.py index 94bed4f28..a98855f85 100644 --- a/apps/authentication/api/connection_token.py +++ b/apps/authentication/api/connection_token.py @@ -218,7 +218,8 @@ class ExtraActionApiMixin(RDPFileClientProtocolURLMixin): def reuse(self, request, *args, **kwargs): instance = self.get_object() if not settings.CONNECTION_TOKEN_REUSABLE: - raise serializers.ValidationError(_('Reusable connection token is not allowed, global setting not enabled')) + error = _('Reusable connection token is not allowed, global setting not enabled') + raise serializers.ValidationError(error) serializer = self.get_serializer(instance, data=request.data, partial=True) serializer.is_valid(raise_exception=True) is_reusable = serializer.validated_data.get('is_reusable', False) diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index 8990a4223..33f0dbaf4 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -232,8 +232,12 @@ class Config(dict): 'SESSION_COOKIE_AGE': 3600 * 24, 'SESSION_EXPIRE_AT_BROWSER_CLOSE': False, 'LOGIN_URL': reverse_lazy('authentication:login'), - 'CONNECTION_TOKEN_ONETIME_EXPIRATION': 5 * 60, # 默认 - 'CONNECTION_TOKEN_REUSABLE_EXPIRATION': 60 * 60 * 24 * 30, # 最大 + + 'CONNECTION_TOKEN_ONETIME_EXPIRATION': 5 * 60, # 默认(new) + 'CONNECTION_TOKEN_EXPIRATION': 5 * 60, # 默认(old) + + 'CONNECTION_TOKEN_REUSABLE_EXPIRATION': 60 * 60 * 24 * 30, # 最大(new) + 'CONNECTION_TOKEN_EXPIRATION_MAX': 60 * 60 * 24 * 30, # 最大(old) 'CONNECTION_TOKEN_REUSABLE': False, # Custom Config