@ysgroup/ui 0.1.11 → 0.1.13
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
|
@@ -18,9 +18,17 @@ const active = ref("security");
|
|
|
18
18
|
const form = reactive({ current: "", next: "", confirm: "" });
|
|
19
19
|
const error = ref("");
|
|
20
20
|
const submitting = ref(false);
|
|
21
|
+
const PASSWORD_REQUIREMENT = "密码须至少包含 8 个字符,并同时包含大写字母、小写字母和数字。";
|
|
21
22
|
|
|
22
23
|
const canChangePassword = computed(() => props.role !== "Root" && props.username?.trim().toLowerCase() !== "root");
|
|
23
24
|
|
|
25
|
+
function isStrongPassword(password: string): boolean {
|
|
26
|
+
return password.length >= 8
|
|
27
|
+
&& /[A-Z]/.test(password)
|
|
28
|
+
&& /[a-z]/.test(password)
|
|
29
|
+
&& /\d/.test(password);
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
function reset() {
|
|
25
33
|
form.current = "";
|
|
26
34
|
form.next = "";
|
|
@@ -47,6 +55,10 @@ async function submit() {
|
|
|
47
55
|
error.value = "请完整填写密码信息";
|
|
48
56
|
return;
|
|
49
57
|
}
|
|
58
|
+
if (!isStrongPassword(form.next)) {
|
|
59
|
+
error.value = PASSWORD_REQUIREMENT;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
50
62
|
if (form.next !== form.confirm) {
|
|
51
63
|
error.value = "两次新密码不一致";
|
|
52
64
|
return;
|
|
@@ -92,12 +104,13 @@ defineExpose({
|
|
|
92
104
|
/>
|
|
93
105
|
<div class="ys-settings__password-link">
|
|
94
106
|
<span>前往 Auth系统修改密码:</span>
|
|
95
|
-
<el-button tag="a" type="primary" :href="passwordManagementUrl" target="_blank" rel="noopener noreferrer">前往</el-button>
|
|
107
|
+
<el-button class="ys-settings__password-button" tag="a" type="primary" :href="passwordManagementUrl" target="_blank" rel="noopener noreferrer">前往</el-button>
|
|
96
108
|
</div>
|
|
97
109
|
</template>
|
|
98
110
|
<template v-else-if="canChangePassword">
|
|
99
111
|
<h3 class="ys-settings__title">修改登录密码</h3>
|
|
100
112
|
<el-alert title="修改成功后,当前账号的所有登录会话都会退出,请使用新密码重新登录。" type="info" :closable="false" show-icon class="ys-settings__notice" />
|
|
113
|
+
<el-alert :title="PASSWORD_REQUIREMENT" type="info" :closable="false" show-icon class="ys-settings__notice" />
|
|
101
114
|
<el-form label-width="110px" @submit.prevent="submit">
|
|
102
115
|
<el-form-item label="当前密码" required>
|
|
103
116
|
<el-input v-model="form.current" type="password" show-password autocomplete="current-password" />
|
|
@@ -141,4 +154,9 @@ defineExpose({
|
|
|
141
154
|
gap: 8px;
|
|
142
155
|
color: var(--ys-color-text-2);
|
|
143
156
|
}
|
|
157
|
+
.ys-settings__password-button,
|
|
158
|
+
.ys-settings__password-button:hover,
|
|
159
|
+
.ys-settings__password-button:focus {
|
|
160
|
+
text-decoration: none;
|
|
161
|
+
}
|
|
144
162
|
</style>
|