Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复钉钉认证登录失败 #2269

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading