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

2FA支持短信验证 & 同时开启多种验证方式 #1625

Merged
merged 6 commits into from
Jun 25, 2022

Conversation

nick2wang
Copy link
Collaborator

@nick2wang nick2wang commented Jun 15, 2022

  1. 接入阿里云&腾讯云的短信服务
  2. 支持同时启用多种验证方式(totp+短信)

已登录配置入口:
image
未登录配置:
image
登录验证:
image

相关配置项
image

@codecov
Copy link

codecov bot commented Jun 15, 2022

Codecov Report

Merging #1625 (a534afa) into master (d2e201f) will decrease coverage by 0.15%.
The diff coverage is 55.17%.

@@            Coverage Diff             @@
##           master    #1625      +/-   ##
==========================================
- Coverage   76.02%   75.87%   -0.16%     
==========================================
  Files          92       92              
  Lines       14319    14393      +74     
==========================================
+ Hits        10886    10920      +34     
- Misses       3433     3473      +40     
Impacted Files Coverage Δ
common/auth.py 65.11% <ø> (+2.42%) ⬆️
sql/views.py 64.80% <0.00%> (-2.90%) ⬇️
sql_api/tests.py 100.00% <ø> (ø)
sql_api/urls.py 100.00% <ø> (ø)
common/twofa/__init__.py 76.92% <50.00%> (-10.04%) ⬇️
sql_api/api_user.py 77.50% <51.06%> (-4.41%) ⬇️
sql_api/serializers.py 79.44% <73.52%> (-2.16%) ⬇️
common/twofa/totp.py 58.33% <75.00%> (-1.35%) ⬇️
common/utils/global_info.py 94.73% <83.33%> (-5.27%) ⬇️
sql/admin.py 92.85% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d2e201f...a534afa. Read the comment docs.

@LeoQuote
Copy link
Collaborator

有没有可能同时支持 otp app 和短信, 让用户自己去选当时用什么 otp 方式?

@hhyo
Copy link
Owner

hhyo commented Jun 15, 2022

是只能支持阿里云通道?看起来不像OTP那样通用

@nick2wang
Copy link
Collaborator Author

是只能支持阿里云通道?看起来不像OTP那样通用

国内第三方短信服务商太多了,没有通用的sdk,如果需要的我再加个腾讯云的支持,应该能覆盖一大部分场景,对于不想使用额外totp应用的用户来说是个补充选择

@nick2wang
Copy link
Collaborator Author

有没有可能同时支持 otp app 和短信, 让用户自己去选当时用什么 otp 方式?

可以做,我再优化下配置流程

@nick2wang nick2wang changed the title 2FA支持短信验证 2FA支持短信验证 & 同时开启多种验证方式 Jun 20, 2022
@nick2wang
Copy link
Collaborator Author

@hhyo @LeoQuote 更新了代码

  1. 支持阿里云&腾讯云短信服务
  2. 可同时开启totp+短信验证

@hhyo hhyo merged commit 94657ef into hhyo:master Jun 25, 2022
@nick2wang nick2wang deleted the 2fa-sms-support branch June 27, 2022 01:06
@JaySem
Copy link

JaySem commented Sep 27, 2023

为什么我开启某个账号的TOTP功能后,输入google验证码后,无法重新登录?弹出1个网页对话框

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.

4 participants