fix: Non organizational DingTalk users scan the code to log in - can successfully log in and create a user

--bug=1052022 --user=王孝刚 【扫码登录】非组织下钉钉用户扫码登录-可登录成功并创建用户 https://www.tapd.cn/57709429/s/1653465
This commit is contained in:
wxg0103 2025-02-11 16:34:54 +08:00 committed by wxg
parent 89c08b4bb0
commit de1d6bda5b

View File

@ -75,6 +75,7 @@ const router = useRouter()
const { user } = useStore() const { user } = useStore()
const { load } = useScriptTag('https://g.alicdn.com/dingding/h5-dingtalk-login/0.21.0/ddlogin.js') const { load } = useScriptTag('https://g.alicdn.com/dingding/h5-dingtalk-login/0.21.0/ddlogin.js')
const isConfigReady = ref(false) const isConfigReady = ref(false)
const errorShown = ref(false)
const initActive = async () => { const initActive = async () => {
try { try {
@ -100,10 +101,11 @@ const initActive = async () => {
{ {
redirect_uri: redirectUri, redirect_uri: redirectUri,
client_id: data.appKey, client_id: data.appKey,
scope: 'openid', scope: 'openid corpid',
response_type: 'code', response_type: 'code',
state: 'fit2cloud-ding-qr', state: 'fit2cloud-ding-qr',
prompt: 'consent' prompt: 'consent',
corpId: data.corp_id
}, },
(loginResult) => { (loginResult) => {
const authCode = loginResult.authCode const authCode = loginResult.authCode
@ -112,8 +114,10 @@ const initActive = async () => {
}) })
}, },
(errorMsg: string) => { (errorMsg: string) => {
MsgError(errorMsg) if (!errorShown.value) {
console.log(errorMsg) MsgError(errorMsg)
errorShown.value = true // true
}
} }
) )
} catch (error) { } catch (error) {