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:
@@ -13,16 +13,17 @@ class Username extends FormzInput<String, String> {
|
||||
}
|
||||
}
|
||||
|
||||
class Email extends FormzInput<String, String> {
|
||||
const Email.pure() : super.pure('');
|
||||
const Email.dirty([super.value = '']) : super.dirty();
|
||||
class Phone extends FormzInput<String, String> {
|
||||
const Phone.pure() : super.pure('');
|
||||
const Phone.dirty([super.value = '']) : super.dirty();
|
||||
|
||||
static final _regex = RegExp(r'^[\w.-]+@[\w.-]+\.\w+$');
|
||||
static final _regex = RegExp(r'^\d{7,14}$');
|
||||
|
||||
@override
|
||||
String? validator(String value) {
|
||||
if (value.isEmpty) return '请输入邮箱';
|
||||
if (!_regex.hasMatch(value)) return '邮箱格式不正确';
|
||||
final normalized = value.replaceAll(RegExp(r'\s+'), '');
|
||||
if (normalized.isEmpty) return '请输入手机号';
|
||||
if (!_regex.hasMatch(normalized)) return '手机号格式不正确';
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user