Merge pull request #7916 from dataease/pr@dev-v2@fix_share_pwd_error

fix: 分享链接填写密码表单没有前端验证
This commit is contained in:
fit2cloud-chenyw 2024-01-30 16:33:46 +08:00 committed by GitHub
commit e5428f37fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,7 +30,7 @@
</div>
<div class="auth-root-class">
<el-button size="small" type="primary" @click="refresh">{{
<el-button size="small" type="primary" @click="refresh(pwdForm)">{{
t('pblink.sure_bt')
}}</el-button>
</div>
@ -71,11 +71,17 @@ const rule = reactive<FormRules>({
]
})
const refresh = () => {
const refresh = async (formEl: FormInstance | undefined) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
const curLocation = window.location.href
const paramIndex = curLocation.indexOf('?')
const uuidIndex = curLocation.indexOf('de-link/') + 8
const uuid = curLocation.substring(uuidIndex, paramIndex !== -1 ? paramIndex : curLocation.length)
const uuid = curLocation.substring(
uuidIndex,
paramIndex !== -1 ? paramIndex : curLocation.length
)
const pwd = form.value.password
const text = uuid + pwd
const ciphertext = rsaEncryp(text)
@ -87,6 +93,10 @@ const refresh = () => {
msg.value = '密码错误'
}
})
} else {
console.error('error submit!', fields)
}
})
}
onMounted(() => {
if (!wsCache.get(appStore.getDekey)) {