0661016827
- 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
37 lines
859 B
Dart
37 lines
859 B
Dart
class LoginRequest {
|
|
final String phone;
|
|
final String token;
|
|
|
|
const LoginRequest({required this.phone, required this.token});
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'phone': _normalizePhone(phone),
|
|
'token': token,
|
|
};
|
|
}
|
|
|
|
String _normalizePhone(String input) {
|
|
var normalized = input.trim();
|
|
normalized = normalized.replaceAll(RegExp(r'[\s\-\(\)]'), '');
|
|
if (normalized.startsWith('00') && normalized.length > 2) {
|
|
return '+${normalized.substring(2)}';
|
|
}
|
|
return normalized;
|
|
}
|
|
|
|
class RefreshRequest {
|
|
final String refreshToken;
|
|
|
|
const RefreshRequest({required this.refreshToken});
|
|
|
|
Map<String, dynamic> toJson() => {'refresh_token': refreshToken};
|
|
}
|
|
|
|
class LogoutRequest {
|
|
final String refreshToken;
|
|
|
|
const LogoutRequest({required this.refreshToken});
|
|
|
|
Map<String, dynamic> toJson() => {'refresh_token': refreshToken};
|
|
}
|