Fix auth: auto-create customer, display name flow, OTP auto-verify
- Backend: getOrCreateCustomer with phone fallback for re-login - Backend: PATCH /api/client/auth/profile for display name update - Client app: AuthNeedsDisplayNameData state + SetDisplayNameScreen - Client app: ApiClient.patch method - Both apps: handle verificationCompleted for auto-verify (test numbers) - Both apps: skip credential sign-in if already auto-verified - Remove debug prints from mitra auth + OTP screens - Fix ChatRequestNotifier.startListening skips when accepting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -54,7 +54,11 @@ class MitraAuth extends _$MitraAuth {
|
||||
final completer = Completer<void>();
|
||||
await _auth.verifyPhoneNumber(
|
||||
phoneNumber: phone,
|
||||
verificationCompleted: (_) {
|
||||
verificationCompleted: (credential) async {
|
||||
try {
|
||||
await _auth.signInWithCredential(credential);
|
||||
state = AsyncData(await _verifyAndReturn());
|
||||
} catch (_) {}
|
||||
if (!completer.isCompleted) completer.complete();
|
||||
},
|
||||
verificationFailed: (e) {
|
||||
@@ -78,7 +82,8 @@ class MitraAuth extends _$MitraAuth {
|
||||
try {
|
||||
if (kIsWeb && _webConfirmationResult != null) {
|
||||
await _webConfirmationResult!.confirm(smsCode);
|
||||
} else {
|
||||
} else if (_auth.currentUser == null) {
|
||||
// Only sign in if not already signed in via auto-verification
|
||||
final credential = PhoneAuthProvider.credential(
|
||||
verificationId: verificationId,
|
||||
smsCode: smsCode,
|
||||
|
||||
Reference in New Issue
Block a user