@ysgroup/ui 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { computed, reactive, ref, watch } from "vue";
|
|
|
4
4
|
|
|
5
5
|
const props = defineProps<{
|
|
6
6
|
modelValue: boolean;
|
|
7
|
+
authenticated: boolean;
|
|
7
8
|
role?: string;
|
|
8
9
|
username?: string;
|
|
9
10
|
passwordManagementUrl?: string;
|
|
@@ -21,12 +22,10 @@ const submitting = ref(false);
|
|
|
21
22
|
const PASSWORD_REQUIREMENT = "密码须至少包含 8 个字符,并同时包含大写字母、小写字母和数字。";
|
|
22
23
|
|
|
23
24
|
const canChangePassword = computed(() => props.role !== "Root" && props.username?.trim().toLowerCase() !== "root");
|
|
25
|
+
const visible = computed(() => props.modelValue && props.authenticated);
|
|
24
26
|
|
|
25
27
|
function isStrongPassword(password: string): boolean {
|
|
26
|
-
return password.length >= 8
|
|
27
|
-
&& /[A-Z]/.test(password)
|
|
28
|
-
&& /[a-z]/.test(password)
|
|
29
|
-
&& /\d/.test(password);
|
|
28
|
+
return password.length >= 8 && /[A-Z]/.test(password) && /[a-z]/.test(password) && /\d/.test(password);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
function reset() {
|
|
@@ -38,12 +37,16 @@ function reset() {
|
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
watch(
|
|
41
|
-
() => props.
|
|
42
|
-
(
|
|
43
|
-
if (!
|
|
40
|
+
() => props.authenticated,
|
|
41
|
+
(authenticated) => {
|
|
42
|
+
if (!authenticated && props.modelValue) emit("update:modelValue", false);
|
|
44
43
|
},
|
|
45
44
|
);
|
|
46
45
|
|
|
46
|
+
watch(visible, (open) => {
|
|
47
|
+
if (!open) reset();
|
|
48
|
+
});
|
|
49
|
+
|
|
47
50
|
function close() {
|
|
48
51
|
if (submitting.value) return;
|
|
49
52
|
emit("update:modelValue", false);
|
|
@@ -82,14 +85,14 @@ defineExpose({
|
|
|
82
85
|
|
|
83
86
|
<template>
|
|
84
87
|
<el-dialog
|
|
85
|
-
:model-value="
|
|
88
|
+
:model-value="visible"
|
|
86
89
|
title="设置中心"
|
|
87
90
|
width="560px"
|
|
88
91
|
destroy-on-close
|
|
89
92
|
:close-on-click-modal="!submitting"
|
|
90
93
|
:close-on-press-escape="!submitting"
|
|
91
94
|
:show-close="!submitting"
|
|
92
|
-
@update:model-value="emit('update:modelValue', $event)"
|
|
95
|
+
@update:model-value="emit('update:modelValue', $event && authenticated)"
|
|
93
96
|
>
|
|
94
97
|
<el-tabs v-model="active" tab-position="left" class="ys-settings">
|
|
95
98
|
<el-tab-pane label="账号安全" name="security">
|