mirror of
https://github.com/veops/cmdb.git
synced 2025-08-07 20:48:31 +08:00
Dev api 240328 (#445)
* feat(api): login api supports parameter auth_with_ldap * fix(api): transfer attribute
This commit is contained in:
@@ -38,8 +38,9 @@ class LoginView(APIView):
|
||||
username = request.values.get("username") or request.values.get("email")
|
||||
password = request.values.get("password")
|
||||
_role = None
|
||||
auth_with_ldap = request.values.get('auth_with_ldap', True)
|
||||
config = AuthenticateDataCRUD(AuthenticateType.LDAP).get()
|
||||
if config.get('enabled') or config.get('enable'):
|
||||
if (config.get('enabled') or config.get('enable')) and auth_with_ldap:
|
||||
from api.lib.perm.authentication.ldap import authenticate_with_ldap
|
||||
user, authenticated = authenticate_with_ldap(username, password)
|
||||
else:
|
||||
|
Reference in New Issue
Block a user