fix(api): ldap authentication

This commit is contained in:
pycook
2023-12-19 00:16:56 +08:00
parent 2d2fb6e1d6
commit fe22e363b4
5 changed files with 7 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ class LoginView(APIView):
password = request.values.get("password")
_role = None
config = AuthenticateDataCRUD(AuthenticateType.LDAP).get()
if config.get('LDAP', {}).get('enabled'):
if config.get('LDAP', {}).get('enabled') or config.get('LDAP', {}).get('enable'):
from api.lib.perm.authentication.ldap import authenticate_with_ldap
user, authenticated = authenticate_with_ldap(username, password)
else:

View File

@@ -1,9 +1,10 @@
from flask import abort, request
from api.lib.common_setting.common_data import AuthenticateDataCRUD
from api.lib.common_setting.const import TestType
from api.lib.common_setting.resp_format import ErrFormat
from api.lib.perm.acl.acl import role_required
from api.resource import APIView
from api.lib.common_setting.common_data import AuthenticateDataCRUD
from api.lib.common_setting.resp_format import ErrFormat
prefix = '/auth_config'