mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: Improve Form Validation on Third-Party Authentication Platforms
This commit is contained in:
committed by
fit2cloud-chenyw
parent
7f6faca17f
commit
8425459095
@@ -128,8 +128,8 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
name: 'cas',
|
||||
}
|
||||
const method = id.value
|
||||
? request.put('/system/authentication', data)
|
||||
: request.post('/system/authentication', data)
|
||||
? request.put('/system/authentication', data, { requestOptions: { silent: true } })
|
||||
: request.post('/system/authentication', data, { requestOptions: { silent: true } })
|
||||
showLoading()
|
||||
method
|
||||
.then((res) => {
|
||||
@@ -138,9 +138,16 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
emits('saved')
|
||||
reset()
|
||||
}
|
||||
closeLoading()
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((e: any) => {
|
||||
if (
|
||||
e.message?.startsWith('sqlbot_authentication_connect_error') ||
|
||||
e.response?.data?.startsWith('sqlbot_authentication_connect_error')
|
||||
) {
|
||||
ElMessage.error(t('ds.connection_failed'))
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
closeLoading()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
name: 'ldap',
|
||||
}
|
||||
const method = id.value
|
||||
? request.put('/system/authentication', data)
|
||||
: request.post('/system/authentication', data)
|
||||
? request.put('/system/authentication', data, { requestOptions: { silent: true } })
|
||||
: request.post('/system/authentication', data, { requestOptions: { silent: true } })
|
||||
showLoading()
|
||||
method
|
||||
.then((res) => {
|
||||
@@ -129,9 +129,16 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
emits('saved')
|
||||
reset()
|
||||
}
|
||||
closeLoading()
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((e: any) => {
|
||||
if (
|
||||
e.message?.startsWith('sqlbot_authentication_connect_error') ||
|
||||
e.response?.data?.startsWith('sqlbot_authentication_connect_error')
|
||||
) {
|
||||
ElMessage.error(t('ds.connection_failed'))
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
closeLoading()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -232,8 +232,8 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
name: 'oauth2',
|
||||
}
|
||||
const method = id.value
|
||||
? request.put('/system/authentication', data)
|
||||
: request.post('/system/authentication', data)
|
||||
? request.put('/system/authentication', data, { requestOptions: { silent: true } })
|
||||
: request.post('/system/authentication', data, { requestOptions: { silent: true } })
|
||||
showLoading()
|
||||
method
|
||||
.then((res) => {
|
||||
@@ -242,9 +242,16 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
emits('saved')
|
||||
reset()
|
||||
}
|
||||
closeLoading()
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((e: any) => {
|
||||
if (
|
||||
e.message?.startsWith('sqlbot_authentication_connect_error') ||
|
||||
e.response?.data?.startsWith('sqlbot_authentication_connect_error')
|
||||
) {
|
||||
ElMessage.error(t('ds.connection_failed'))
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
closeLoading()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
name: 'oidc',
|
||||
}
|
||||
const method = id.value
|
||||
? request.put('/system/authentication', data)
|
||||
: request.post('/system/authentication', data)
|
||||
? request.put('/system/authentication', data, { requestOptions: { silent: true } })
|
||||
: request.post('/system/authentication', data, { requestOptions: { silent: true } })
|
||||
showLoading()
|
||||
method
|
||||
.then((res) => {
|
||||
@@ -184,9 +184,16 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
emits('saved')
|
||||
reset()
|
||||
}
|
||||
closeLoading()
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((e: any) => {
|
||||
if (
|
||||
e.message?.startsWith('sqlbot_authentication_connect_error') ||
|
||||
e.response?.data?.startsWith('sqlbot_authentication_connect_error')
|
||||
) {
|
||||
ElMessage.error(t('ds.connection_failed'))
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
closeLoading()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user