瀏覽代碼

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

Ying Chen 4 年之前
父節點
當前提交
11b89004f9
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      desktop/core/src/desktop/middleware.py

+ 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/']:
       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
 
     # Skip views not requiring login