Skip to content

Commit

Permalink
fix: use SITE_URL replace /login/
Browse files Browse the repository at this point in the history
  • Loading branch information
nannan00 committed Feb 20, 2024
1 parent 086aacd commit 90d3550
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/bk-login/bklogin/authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ def get(self, request, *args, **kwargs):
# session记录登录的租户
request.session[SIGN_IN_TENANT_ID_SESSION_KEY] = global_info.only_enabled_auth_tenant.id
# 联邦登录,则直接重定向到第三方登录
return HttpResponseRedirect(f"/login/auth/idps/{idp.id}/actions/{BuiltinActionEnum.LOGIN}/")
return HttpResponseRedirect(
f"{settings.SITE_URL}auth/idps/{idp.id}/actions/{BuiltinActionEnum.LOGIN}/"
)

# 返回登录页面
return render(request, self.template_name)
Expand Down Expand Up @@ -362,15 +364,15 @@ def _dispatch_federation_idp_plugin(
# 记录支持登录的租户用户
request.session[ALLOWED_SIGN_IN_TENANT_USERS_SESSION_KEY] = tenant_users
# 联邦认证则重定向到前端选择账号页面
return HttpResponseRedirect(redirect_to="/login/page/users/")
return HttpResponseRedirect(redirect_to=f"{settings.SITE_URL}page/users/")

return self.wrap_plugin_error(
plugin_error_context, plugin.dispatch_extension, action=action, http_method=http_method, request=request
)

def _get_complete_action_url(self, idp_id: str, action: str) -> str:
"""获取完整"""
return urljoin(settings.BK_LOGIN_URL, f"/login/auth/idps/{idp_id}/actions/{action}/")
return urljoin(settings.BK_LOGIN_URL, f"{settings.SITE_URL}auth/idps/{idp_id}/actions/{action}/")

def _auth_backend(
self, request, sign_in_tenant_id: str, idp_id: str, user_infos: Dict[str, Any] | List[Dict[str, Any]]
Expand Down

0 comments on commit 90d3550

Please sign in to comment.