fix(auth): surface validation errors in email login/register forms
Validation failure was previously silent — the form's submit() returned
without dispatching or showing anything on screen, so users could not tell
why the login/register button appeared to do nothing.
Changes:
- Add validationError local state in EmailLoginForm and EmailRegisterForm
- Display first validation error via AuthErrorMessage, prioritised over
the server's globalError (validation errors feel more immediate)
- Clear validation error on field change (standard "error fades as you
fix it" UX) — implemented as onChange handlers, not useEffect, to
avoid React's cascading-render anti-pattern
- Add observability to the entire email flow (was previously silent end
to end): form submit ENTRY, validator rejection, actor ENTRY, actor
DONE — mirrors the logging style already used by guestLoginActor
- Add entry: assign({ errorMessage: null }) to loadingEmailLogin and
loadingEmailRegister so stale errors clear on transition into the
loading state (matches loadingGuestLogin)
This commit is contained in:
@@ -1,17 +1,10 @@
|
||||
/**
|
||||
* 登录状态枚举
|
||||
*
|
||||
* 原始 Dart: lib/ui/auth/bloc/auth_state.dart 的 `LoginType` 枚举(v7.0 新增)。
|
||||
*
|
||||
* 2025-XX 改造:语义从"登录方式"扩展为"当前登录状态"——
|
||||
* 包含 notLoggedIn / guest / 各 OAuth provider 登录后态。
|
||||
*
|
||||
* 字段命名(state)从 `loginType` 改为 `loginStatus`,更贴合语义。
|
||||
*/
|
||||
export const LoginStatus = {
|
||||
/** 未登录(默认初值) */
|
||||
NotLoggedIn: "notLoggedIn",
|
||||
/** 游客登录(无需账号,10 轮免费消息) */
|
||||
/** 游客登录 */
|
||||
Guest: "guest",
|
||||
/** Facebook OAuth 登录 */
|
||||
Facebook: "facebook",
|
||||
|
||||
Reference in New Issue
Block a user