mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: enhance chat authentication logic and update model handling for chat platform
This commit is contained in:
parent
9f31832b4d
commit
dd7b2a7bda
|
|
@ -64,8 +64,14 @@ class AuthProfileSerializer(serializers.Serializer):
|
|||
'authentication': False
|
||||
}
|
||||
application_setting_model = DatabaseModelManage.get_model('application_setting')
|
||||
if application_setting_model:
|
||||
chat_platform = DatabaseModelManage.get_model('chat_platform')
|
||||
if application_setting_model and chat_platform:
|
||||
application_setting = QuerySet(application_setting_model).filter(application_id=application_id).first()
|
||||
types = QuerySet(chat_platform).filter(is_active=True, is_valid=True).values_list('auth_type', flat=True)
|
||||
login_value = application_access_token.authentication_value.get('login_value', [])
|
||||
final_login_value = list(set(login_value) & set(types))
|
||||
if 'LOCAL' in login_value:
|
||||
final_login_value.insert(0, 'LOCAL')
|
||||
if application_setting is not None:
|
||||
profile = {
|
||||
'icon': application_setting.application.icon,
|
||||
|
|
@ -74,7 +80,7 @@ class AuthProfileSerializer(serializers.Serializer):
|
|||
'authentication': application_access_token.authentication,
|
||||
'authentication_type': application_access_token.authentication_value.get(
|
||||
'type', 'password'),
|
||||
'login_value': application_access_token.authentication_value.get('login_value', [])
|
||||
'login_value': final_login_value
|
||||
}
|
||||
return profile
|
||||
|
||||
|
|
|
|||
|
|
@ -211,7 +211,6 @@ class UserManageSerializer(serializers.Serializer):
|
|||
is_active = serializers.BooleanField(
|
||||
required=False,
|
||||
label=_("Is active"),
|
||||
default=True
|
||||
)
|
||||
source = serializers.CharField(
|
||||
required=False,
|
||||
|
|
@ -223,7 +222,7 @@ class UserManageSerializer(serializers.Serializer):
|
|||
username = self.data.get('username')
|
||||
nick_name = self.data.get('nick_name')
|
||||
email = self.data.get('email')
|
||||
is_active = self.data.get('is_active', True)
|
||||
is_active = self.data.get('is_active', None)
|
||||
source = self.data.get('source', None)
|
||||
query_set = QuerySet(User)
|
||||
if username is not None:
|
||||
|
|
|
|||
Loading…
Reference in New Issue