feat(webui): strengthen password change guidance

Use consistent field labels, validation, and strength guidance in both password-change flows.

Show requirements only while the new-password field is active and surface validation failures clearly.
This commit is contained in:
DrSmoothl committed 2026-07-31 15:35:29 +08:00
1 parent b982927b4a
commit f066f3c89c
8 files changed
+1210 -132

No files matched your search

+7 -8
View File
@@ -438,15 +438,14 @@ class HttpApiClient implements ApiClient {
}
async checkPasswordStrength(password: string): Promise<{ rules: PasswordRule[]; valid: boolean }> {
try {
const data = await this.postJson<{ rules?: PasswordRule[]; valid?: boolean }>(
'/api/auth/check-strength',
{ password },
);
return { rules: data.rules ?? [], valid: !!data.valid };
} catch {
return { rules: [], valid: false };
const data = await this.postJson<{ rules?: PasswordRule[]; valid?: boolean }>(
'/api/auth/check-strength',
{ password },
);
if (!Array.isArray(data.rules) || typeof data.valid !== 'boolean') {
throw new ApiError(502, '密码强度接口返回了无效响应');
}
return { rules: data.rules, valid: data.valid };
}
async changePassword(oldPassword: string, newPassword: string): Promise<ChangePasswordResult> {