From 840f6a1b1523024d88515ab4f52026d1f1b0a016 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 27 Oct 2026 16:51:14 +0800 Subject: [PATCH] fix: streamline authentication value assignment and ensure proper saving of application access token --- .../serializers/application_access_token.py | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/application/serializers/application_access_token.py b/apps/application/serializers/application_access_token.py index 671dd7fea21..cdb3f41a7e2 100644 --- a/apps/application/serializers/application_access_token.py +++ b/apps/application/serializers/application_access_token.py @@ -75,24 +75,22 @@ def edit(self, instance): application_access_token.language = None if "authentication" in instance and instance.get("authentication") is not None: application_access_token.authentication = instance.get("authentication") - if instance.get("authentication_value") is None: - application_access_token.authentication_value = { - "type": "login", - "lock_time": 10, - "login_value": ["LOCAL"], - "max_attempts": 1, - "default_value": "LOCAL", - "failed_attempts": 5, - } + application_access_token.authentication_value = { + "type": "login", + "lock_time": 10, + "login_value": ["LOCAL"], + "max_attempts": 1, + "default_value": "LOCAL", + "failed_attempts": 5, + } - application_access_token.save() license_is_valid = cache.get( Cache_Version.SYSTEM.get_key(key="license_is_valid"), version=Cache_Version.SYSTEM.get_version() ) if license_is_valid: if instance.get("authentication") is not None and instance.get("authentication_value") is not None: application_access_token.authentication_value = instance.get("authentication_value") - application_access_token.save() + application_access_token.save() return self.one(with_valid=False) def one(self, with_valid=True): @@ -110,7 +108,10 @@ def one(self, with_valid=True): license_is_valid = cache.get( Cache_Version.SYSTEM.get_key(key="license_is_valid"), version=Cache_Version.SYSTEM.get_version() ) - other = {"authentication": application_access_token.authentication} + other = { + "authentication": application_access_token.authentication, + "authentication_value": application_access_token.authentication_value, + } if license_is_valid: other = { "authentication": application_access_token.authentication,