feat(client): 登录体验 — 记住邮箱 + 密码显隐 + 7天免登陆
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled

1. 记住邮箱:登录页预填上次邮箱(TokenStore.saveLastEmail,登录/注册成功时存,
   退出登录不清除)。
2. 密码显隐:登录/注册密码框加眼睛按钮切换明文(PangolinIcons.eye/eyeOff)。
3. 7天免登陆:RootFlow 改为响应 authProvider——启动时有有效会话直接进主界面;
   AuthNotifier.refresh() 在服务端拒绝(refresh 过期/超 7 天)时 logout 回登录页,
   网络错误则保留会话。会话恢复期间显示极简启动屏。

flutter analyze 0 error;114 tests passed。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-19 06:28:49 +08:00
parent a6b35268ab
commit aee9ba7b72
9 changed files with 89 additions and 18 deletions
+5
View File
@@ -14,6 +14,7 @@ class TokenStore {
static const _kAccess = 'pangolin_access_token';
static const _kRefresh = 'pangolin_refresh_token';
static const _kOnboarded = 'pangolin_onboarded';
static const _kLastEmail = 'pangolin_last_email';
Future<void> saveTokens({
required String access,
@@ -34,4 +35,8 @@ class TokenStore {
// 首次引导标记:引导页只在第一次看(看完置位,后续登录直接进主界面)。
Future<void> markOnboarded() => _storage.write(key: _kOnboarded, value: '1');
Future<bool> isOnboarded() async => (await _storage.read(key: _kOnboarded)) == '1';
// 记住上次登录邮箱(登录页预填;退出登录不清除)。
Future<void> saveLastEmail(String email) => _storage.write(key: _kLastEmail, value: email);
Future<String?> loadLastEmail() => _storage.read(key: _kLastEmail);
}