feat(auth): transition from email to phone-based OTP authentication

- Replace Email+Password login with Phone+OTP flow
- Remove RegisterCubit and registration screens (email verification)
- Remove ResetPasswordCubit and reset password screens
- Add phone normalization and international dial code support
- Update LoginCubit with sendCode/resend cooldown logic
- Add new widgets: phone prefix selector, confirm sheet
- Update all auth API endpoints: /otp/send, /phone-session
- Update form inputs: Email -> Phone with E.164 validation
- Update tests for new auth flow
This commit is contained in:
qzl
2026-03-19 18:42:05 +08:00
parent 636b37ee5a
commit 0661016827
29 changed files with 615 additions and 2030 deletions
@@ -50,7 +50,7 @@ void main() {
refreshToken: 'new_refresh',
expiresIn: 3600,
tokenType: 'bearer',
user: const AuthUser(id: '123', email: 'test@example.com'),
user: const AuthUser(id: '123', phone: '+8613812345678'),
),
);
return authBloc;
@@ -107,7 +107,7 @@ void main() {
build: () => authBloc,
act: (bloc) => bloc.add(
AuthLoggedIn(
user: const AuthUser(id: '1', email: 'test@example.com'),
user: const AuthUser(id: '1', phone: '+8613812345678'),
),
),
expect: () => [isA<AuthAuthenticated>()],
@@ -120,7 +120,7 @@ void main() {
return authBloc;
},
seed: () => AuthAuthenticated(
user: const AuthUser(id: '1', email: 'test@example.com'),
user: const AuthUser(id: '1', phone: '+8613812345678'),
),
act: (bloc) => bloc.add(AuthLoggedOut()),
expect: () => [
@@ -137,7 +137,7 @@ void main() {
return authBloc;
},
seed: () => AuthAuthenticated(
user: const AuthUser(id: '1', email: 'test@example.com'),
user: const AuthUser(id: '1', phone: '+8613812345678'),
),
act: (bloc) => bloc.add(
const AuthSessionInvalidated(