fix: 登录页补充 42300 账号锁定错误码映射

- 对齐后端 T4 新增的登录锁定契约(openapi.yaml),锁定时展示明确横幅而非通用兜底
- 门禁:format 0 changed / analyze 0 issues / flutter test 30 passed
This commit is contained in:
2026-09-04 12:17:25 +08:00
parent 8d890c0424
commit da25804a06
2 changed files with 8 additions and 3 deletions
+5 -3
View File
@@ -110,9 +110,11 @@ class _LoginPageState extends State<LoginPage> {
// 认证状态机随 saveSession 切换,根路由 300ms fade 进主壳。
} on ApiBusinessException catch (error) {
if (!mounted) return;
_showFormError(
error.code == ApiCodes.badCredentials ? '用户名或密码错误' : '登录失败,请稍后重试',
);
_showFormError(switch (error.code) {
ApiCodes.badCredentials => '用户名或密码错误',
ApiCodes.loginLocked => '尝试次数过多,账号已临时锁定,请稍后再试',
_ => '登录失败,请稍后重试',
});
} on ApiRateLimitException {
if (!mounted) return;
_showFormError('尝试次数过多,请稍后再试');