Skip to content

Commit

Permalink
修复钉钉认证登录失败 (#2269)
Browse files Browse the repository at this point in the history
fixed dingding auth, change django-auth-dingding version from 0.0.2 to 0.0.3
  • Loading branch information
quanbisen authored Aug 25, 2023
1 parent 5e5c0f8 commit 9d01416
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions common/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -201,5 +202,11 @@ 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"))
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9d01416

Please sign in to comment.