diff --git a/common/auth.py b/common/auth.py index 3bb227be6a..6054539e2b 100644 --- a/common/auth.py +++ b/common/auth.py @@ -11,6 +11,7 @@ from django.http import HttpResponse, HttpResponseRedirect from django.urls import reverse +from archery import settings from common.config import SysConfig from common.utils.ding_api import get_ding_user_id from sql.models import Users, ResourceGroup, TwoFactorAuthConfig @@ -201,5 +202,9 @@ def sign_up(request): # 退出登录 def sign_out(request): + user = request.user logout(request) + # 如果开启了钉钉认证,重定向到钉钉退出登录页面 + if user.ding_user_id and settings.ENABLE_DINGDING: + return HttpResponseRedirect(redirect_to="https://login.dingtalk.com/oauth2/logout") return HttpResponseRedirect(reverse("sql:login")) diff --git a/requirements.txt b/requirements.txt index 0857a3d03b..8ec506fc76 100644 --- a/requirements.txt +++ b/requirements.txt @@ -38,5 +38,5 @@ django-environ==0.8.1 alibabacloud_dysmsapi20170525==2.0.9 tencentcloud-sdk-python==3.0.656 mozilla-django-oidc==3.0.0 -django-auth-dingding==0.0.2 +django-auth-dingding==0.0.3 cassandra-driver