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:
8 files changed
+1210
-132
No files matched your search
@@ -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> {
|
||||
|
||||
Reference in new issue
Block a user