Skip to content

Commit

Permalink
重写Auth2.0登录逻辑 (mindoc-org#851)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
LawyZheng authored and Go-Go-Farther committed Jun 6, 2023
1 parent 745c16b commit e417fc2
Show file tree
Hide file tree
Showing 17 changed files with 1,905 additions and 760 deletions.
1 change: 1 addition & 0 deletions commands/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func RegisterModel() {
new(models.Itemsets),
new(models.Comment),
new(models.WorkWeixinAccount),
new(models.DingTalkAccount),
)
gob.Register(models.Blog{})
gob.Register(models.Document{})
Expand Down
12 changes: 0 additions & 12 deletions conf/app.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,6 @@ dingtalk_app_key="${MINDOC_DINGTALK_APPKEY}"
# 钉钉AppSecret
dingtalk_app_secret="${MINDOC_DINGTALK_APPSECRET}"

# 钉钉登录默认只读账号
dingtalk_tmp_reader="${MINDOC_DINGTALK_READER}"

# 钉钉扫码登录Key
dingtalk_qr_key="${MINDOC_DINGTALK_QRKEY}"

# 钉钉扫码登录Secret
dingtalk_qr_secret="${MINDOC_DINGTALK_QRSECRET}"

########企业微信登录配置##############

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

# 通讯录密钥
workweixin_contact_secret="${MINDOC_WORKWEIXIN_CONTACT_SECRET}"

# i18n config
default_lang="zh-cn"
4 changes: 3 additions & 1 deletion conf/lang/en-us.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ captcha = Captcha
keep_login = Stay signed in
forgot_password = Forgot password?
register = Create New Account
dingtalk_login = DingTalk QrCode login
third_party_login = Third Party Login
dingtalk_login = DingTalk Login
wecom_login = WeCom Login
account_recovery = Account recovery
new_password = New password
confirm_password = Confirm password
Expand Down
4 changes: 3 additions & 1 deletion conf/lang/zh-cn.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ captcha = 验证码
keep_login = 保持登录
forgot_password = 忘记密码?
register = 立即注册
dingtalk_login = 扫码登录
third_party_login = 第三方登录
dingtalk_login = 钉钉登录
wecom_login = 企业微信登录
account_recovery = 找回密码
new_password = 新密码
confirm_password = 确认密码
Expand Down
32 changes: 16 additions & 16 deletions conf/workweixin.go
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
package conf

import (
"github.com/beego/beego/v2/server/web"
"github.com/beego/beego/v2/server/web"
)

type WorkWeixinConf struct {
CorpId string // 企业ID
AgentId string // 应用ID
Secret string // 应用密钥
ContactSecret string // 通讯录密钥
CorpId string // 企业ID
AgentId string // 应用ID
Secret string // 应用密钥
// ContactSecret string // 通讯录密钥
}

func GetWorkWeixinConfig() *WorkWeixinConf {
corpid, _ := web.AppConfig.String("workweixin_corpid")
agentid, _ := web.AppConfig.String("workweixin_agentid")
secret, _ := web.AppConfig.String("workweixin_secret")
contact_secret, _ := web.AppConfig.String("workweixin_contact_secret")
corpid, _ := web.AppConfig.String("workweixin_corpid")
agentid, _ := web.AppConfig.String("workweixin_agentid")
secret, _ := web.AppConfig.String("workweixin_secret")
// contact_secret, _ := web.AppConfig.String("workweixin_contact_secret")

c := &WorkWeixinConf{
CorpId: corpid,
AgentId: agentid,
Secret: secret,
ContactSecret: contact_secret,
}
return c
c := &WorkWeixinConf{
CorpId: corpid,
AgentId: agentid,
Secret: secret,
// ContactSecret: contact_secret,
}
return c
}
Loading

0 comments on commit e417fc2

Please sign in to comment.