Эх сурвалжийг харах

Allow /api/token/auth can create user or make it active when auto login enabled (#2420)

Ying Chen 4 жил өмнө
parent
commit
11b89004f9

+ 3 - 1
desktop/core/src/desktop/middleware.py

@@ -308,7 +308,9 @@ class LoginAndPermissionMiddleware(MiddlewareMixin):
     if request.path in ['/oidc/authenticate/', '/oidc/callback/', '/oidc/logout/', '/hue/oidc_failed/']:
     if request.path in ['/oidc/authenticate/', '/oidc/callback/', '/oidc/logout/', '/hue/oidc_failed/']:
       return None
       return None
 
 
-    if request.path.startswith('/api/'):
+    if AUTH.AUTO_LOGIN_ENABLED.get() and request.path.startswith('/api/token/auth'):
+      pass # allow /api/token/auth can create user or make it active
+    elif request.path.startswith('/api/'):
       return None
       return None
 
 
     # Skip views not requiring login
     # Skip views not requiring login