Skip to content

Commit e417fc2

Browse files
LawyZhengGo-Go-Farther
authored andcommitted
重写Auth2.0登录逻辑 (mindoc-org#851)
* go mod update * feat: change to new wxwork sso login * fix: can't log in by workwx browser * fix: workwx auto regist * fix: change app.conf.example * fix: workwx account can't be disabled * fix: workwx account delete * fix: workwx bind error * feat: optimize wecom login * feat: rewrite dingtalk login * feat: rewrite dingtalk login * feat: optimize auth2 login
1 parent 745c16b commit e417fc2

17 files changed

+1905
-760
lines changed

commands/command.go

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ func RegisterModel() {
138138
new(models.Itemsets),
139139
new(models.Comment),
140140
new(models.WorkWeixinAccount),
141+
new(models.DingTalkAccount),
141142
)
142143
gob.Register(models.Blog{})
143144
gob.Register(models.Document{})

conf/app.conf.example

-12
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,6 @@ dingtalk_app_key="${MINDOC_DINGTALK_APPKEY}"
232232
# 钉钉AppSecret
233233
dingtalk_app_secret="${MINDOC_DINGTALK_APPSECRET}"
234234

235-
# 钉钉登录默认只读账号
236-
dingtalk_tmp_reader="${MINDOC_DINGTALK_READER}"
237-
238-
# 钉钉扫码登录Key
239-
dingtalk_qr_key="${MINDOC_DINGTALK_QRKEY}"
240-
241-
# 钉钉扫码登录Secret
242-
dingtalk_qr_secret="${MINDOC_DINGTALK_QRSECRET}"
243-
244235
########企业微信登录配置##############
245236

246237
# 企业ID
@@ -252,8 +243,5 @@ workweixin_agentid="${MINDOC_WORKWEIXIN_AGENTID}"
252243
# 应用密钥
253244
workweixin_secret="${MINDOC_WORKWEIXIN_SECRET}"
254245

255-
# 通讯录密钥
256-
workweixin_contact_secret="${MINDOC_WORKWEIXIN_CONTACT_SECRET}"
257-
258246
# i18n config
259247
default_lang="zh-cn"

conf/lang/en-us.ini

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ captcha = Captcha
2222
keep_login = Stay signed in
2323
forgot_password = Forgot password?
2424
register = Create New Account
25-
dingtalk_login = DingTalk QrCode login
25+
third_party_login = Third Party Login
26+
dingtalk_login = DingTalk Login
27+
wecom_login = WeCom Login
2628
account_recovery = Account recovery
2729
new_password = New password
2830
confirm_password = Confirm password

conf/lang/zh-cn.ini

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ captcha = 验证码
2222
keep_login = 保持登录
2323
forgot_password = 忘记密码?
2424
register = 立即注册
25-
dingtalk_login = 扫码登录
25+
third_party_login = 第三方登录
26+
dingtalk_login = 钉钉登录
27+
wecom_login = 企业微信登录
2628
account_recovery = 找回密码
2729
new_password = 新密码
2830
confirm_password = 确认密码

conf/workweixin.go

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
package conf
22

33
import (
4-
"github.com/beego/beego/v2/server/web"
4+
"github.com/beego/beego/v2/server/web"
55
)
66

77
type WorkWeixinConf struct {
8-
CorpId string // 企业ID
9-
AgentId string // 应用ID
10-
Secret string // 应用密钥
11-
ContactSecret string // 通讯录密钥
8+
CorpId string // 企业ID
9+
AgentId string // 应用ID
10+
Secret string // 应用密钥
11+
// ContactSecret string // 通讯录密钥
1212
}
1313

1414
func GetWorkWeixinConfig() *WorkWeixinConf {
15-
corpid, _ := web.AppConfig.String("workweixin_corpid")
16-
agentid, _ := web.AppConfig.String("workweixin_agentid")
17-
secret, _ := web.AppConfig.String("workweixin_secret")
18-
contact_secret, _ := web.AppConfig.String("workweixin_contact_secret")
15+
corpid, _ := web.AppConfig.String("workweixin_corpid")
16+
agentid, _ := web.AppConfig.String("workweixin_agentid")
17+
secret, _ := web.AppConfig.String("workweixin_secret")
18+
// contact_secret, _ := web.AppConfig.String("workweixin_contact_secret")
1919

20-
c := &WorkWeixinConf{
21-
CorpId: corpid,
22-
AgentId: agentid,
23-
Secret: secret,
24-
ContactSecret: contact_secret,
25-
}
26-
return c
20+
c := &WorkWeixinConf{
21+
CorpId: corpid,
22+
AgentId: agentid,
23+
Secret: secret,
24+
// ContactSecret: contact_secret,
25+
}
26+
return c
2727
}

0 commit comments

Comments
 (0)