From 3cc272c5e068f00a8eabaf33c54e5dff71ec2fc2 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Mon, 14 Jul 2025 19:27:31 +0800 Subject: [PATCH] fix: chat user (#3591) --- apps/chat/serializers/chat_authentication.py | 6 +++--- .../auth/handle/impl/chat_anonymous_user_token.py | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/chat/serializers/chat_authentication.py b/apps/chat/serializers/chat_authentication.py index 4f28d2f58..e90e3146e 100644 --- a/apps/chat/serializers/chat_authentication.py +++ b/apps/chat/serializers/chat_authentication.py @@ -70,10 +70,10 @@ class AuthProfileSerializer(serializers.Serializer): 'icon': application_setting.application.icon, 'application_name': application_setting.application.name, 'bg_icon': application_setting.chat_background, - 'authentication': application_setting.authentication, - 'authentication_type': application_setting.authentication_value.get( + 'authentication': application_access_token.authentication, + 'authentication_type': application_access_token.authentication_value.get( 'type', 'password'), - 'login_value': application_setting.authentication_value.get('login_value', []) + 'login_value': application_access_token.authentication_value.get('login_value', []) } return profile diff --git a/apps/common/auth/handle/impl/chat_anonymous_user_token.py b/apps/common/auth/handle/impl/chat_anonymous_user_token.py index 599343c7e..cea9467b5 100644 --- a/apps/common/auth/handle/impl/chat_anonymous_user_token.py +++ b/apps/common/auth/handle/impl/chat_anonymous_user_token.py @@ -41,12 +41,10 @@ class ChatAnonymousUserToken(AuthBaseHandle): raise AppAuthenticationFailed(1002, _('Authentication information is incorrect')) if not application_access_token.access_token == access_token: raise AppAuthenticationFailed(1002, _('Authentication information is incorrect')) - application_setting_model = DatabaseModelManage.get_model("application_setting") - if application_setting_model is not None: - application_setting = QuerySet(application_setting_model).filter(application_id=application_id).first() - if application_setting.authentication: - if chat_user_token.authentication.auth_type != application_setting.authentication_value.get('type', ''): - raise AppAuthenticationFailed(1002, _('Authentication information is incorrect')) + if application_access_token.authentication: + if chat_user_token.authentication.auth_type != application_access_token.authentication_value.get('type', + ''): + raise AppAuthenticationFailed(1002, _('Authentication information is incorrect')) return None, ChatAuth( current_role_list=[RoleConstants.CHAT_ANONYMOUS_USER], permission_list=[