From c3737f47511e82dcae665b070ac2b0b7409e36dd Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 30 Jan 2024 16:29:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=86=E4=BA=AB=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E5=A1=AB=E5=86=99=E5=AF=86=E7=A0=81=E8=A1=A8=E5=8D=95=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=89=8D=E7=AB=AF=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/share/link/pwd.vue | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/core/core-frontend/src/views/share/link/pwd.vue b/core/core-frontend/src/views/share/link/pwd.vue index 327c71d8a1..a9ad6eb164 100644 --- a/core/core-frontend/src/views/share/link/pwd.vue +++ b/core/core-frontend/src/views/share/link/pwd.vue @@ -30,7 +30,7 @@
- {{ + {{ t('pblink.sure_bt') }}
@@ -71,20 +71,30 @@ const rule = reactive({ ] }) -const refresh = () => { - 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 pwd = form.value.password - const text = uuid + pwd - const ciphertext = rsaEncryp(text) - request.post({ url: '/share/validate', data: { ciphertext } }).then(res => { - if (res.data) { - wsCache.set(`link-${uuid}`, ciphertext) - window.location.reload() +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 pwd = form.value.password + const text = uuid + pwd + const ciphertext = rsaEncryp(text) + request.post({ url: '/share/validate', data: { ciphertext } }).then(res => { + if (res.data) { + wsCache.set(`link-${uuid}`, ciphertext) + window.location.reload() + } else { + msg.value = '密码错误' + } + }) } else { - msg.value = '密码错误' + console.error('error submit!', fields) } }) }