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

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

merged 1 commit into from
Aug 25, 2023

Conversation

quanbisen
Copy link
Collaborator

@quanbisen quanbisen commented Aug 25, 2023

  1. 修复钉钉认证登录失败,原因调用钉钉接口缺少授权参数,导致登录无权限,已更新了django_dingding_auth版本到0.0.3修复
  2. 添加了钉钉认证方式的退出登录逻辑,跳转到钉钉的logout页面,清除钉钉认证成功的浏览器相关cookie。

@codecov
Copy link

codecov bot commented Aug 25, 2023

Codecov Report

Patch coverage: 25.00% and project coverage change: -0.03% ⚠️

Comparison is base (5e5c0f8) 75.53% compared to head (3dc9099) 75.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2269      +/-   ##
==========================================
- Coverage   75.53%   75.50%   -0.03%     
==========================================
  Files         107      107              
  Lines       15456    15460       +4     
==========================================
- Hits        11674    11673       -1     
- Misses       3782     3787       +5     
Files Changed Coverage Δ
common/auth.py 63.90% <25.00%> (-1.21%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LeoQuote
Copy link
Collaborator

LeoQuote commented Aug 25, 2023

这边能否把登出的逻辑写到新的页面

Archery/common/auth.py

Lines 203 to 205 in 5e5c0f8

def sign_out(request):
logout(request)
return HttpResponseRedirect(reverse("sql:login"))

这里不返回一个 redirect, 而是返回一个网页, 网页里按情况执行你所说的东西.

或者在 python 代码里, 直接重定向用户至钉钉的登出页面, 你觉得如何?

因为 base 里尽量加的还是一些普适性的东西, 只是为了登出一个功能加就有些没必要了

@quanbisen
Copy link
Collaborator Author

嗯嗯,我修改一下,我在logout函数这里加一下重定向到钉钉的登出页面,我也看了一下技术方案,钉钉的退出登录只能浏览器访问才能删除cookie.

@LeoQuote
Copy link
Collaborator

django 可以返回一个 HttpResponseRedirect , 这样用户拿到一个 302 请求, 是可以把用户重定向过去的

@quanbisen
Copy link
Collaborator Author

django 可以返回一个 HttpResponseRedirect , 这样用户拿到一个 302 请求, 是可以把用户重定向过去的

已更新代码到sign_out函数实现重定向

@LeoQuote LeoQuote merged commit 9d01416 into hhyo:master Aug 25, 2023
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants