R25-1 R25-2 R25-3: 修复登录改密并收口静态缓存
这个提交包含在:
@@ -7,6 +7,12 @@ import { Button } from "../components/ui/button";
|
||||
import { Input } from "../components/ui/input";
|
||||
import { Label } from "../components/ui/label";
|
||||
|
||||
const PASSWORD_REQUIREMENTS = [
|
||||
"至少 12 位",
|
||||
"包含大写字母、小写字母和数字",
|
||||
"不要使用公司名、常见顺序或过于简单的组合",
|
||||
];
|
||||
|
||||
export function ChangePasswordPage() {
|
||||
const navigate = useNavigate();
|
||||
const { changePassword } = useAuth();
|
||||
@@ -29,10 +35,10 @@ export function ChangePasswordPage() {
|
||||
setSubmitting(true);
|
||||
try {
|
||||
await changePassword(oldPassword, newPassword);
|
||||
navigate("/dashboard", { replace: true });
|
||||
navigate("/portal", { replace: true });
|
||||
} catch (err) {
|
||||
if (isApiError(err)) {
|
||||
setError(`${err.code}: ${mapApiErrorMessage(err.code, err.details, err.message)}`);
|
||||
setError(mapApiErrorMessage(err.code, err.details, err.message));
|
||||
} else {
|
||||
setError("修改密码失败,请稍后重试");
|
||||
}
|
||||
@@ -76,6 +82,16 @@ export function ChangePasswordPage() {
|
||||
type="password"
|
||||
value={newPassword}
|
||||
/>
|
||||
<p className="text-xs text-zinc-500">密码要求:{PASSWORD_REQUIREMENTS.join(";")}。</p>
|
||||
</div>
|
||||
|
||||
<div className="rounded-lg border border-zinc-200 bg-zinc-50 px-3 py-2 text-xs text-zinc-600">
|
||||
<p className="font-medium text-zinc-700">建议的新密码规则</p>
|
||||
<ul className="mt-1 list-disc space-y-1 pl-4">
|
||||
{PASSWORD_REQUIREMENTS.map((item) => (
|
||||
<li key={item}>{item}</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
|
||||
在新工单中引用
屏蔽一个用户