fix: chat user (#3591)

This commit is contained in:
shaohuzhang1 2025-07-14 19:27:31 +08:00 committed by GitHub
parent bf1942e0f9
commit 3cc272c5e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 9 deletions

View File

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

View File

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