feat: Implement email verification flow for user registration, update API base URL, and refine agent search screen UI.

This commit is contained in:
pradeepkumar
2026-03-16 15:32:17 +05:30
parent 9512f5ef8d
commit e195696733
5 changed files with 14 additions and 17 deletions

View File

@@ -20,6 +20,7 @@ class AuthState {
final bool requiresTwoFactor;
final String? tempToken;
final String? twoFactorEmail;
final bool registrationSuccess;
const AuthState({
this.status = AuthStatus.initial,
@@ -30,6 +31,7 @@ class AuthState {
this.requiresTwoFactor = false,
this.tempToken,
this.twoFactorEmail,
this.registrationSuccess = false,
});
AuthState copyWith({
@@ -41,6 +43,7 @@ class AuthState {
bool? requiresTwoFactor,
String? tempToken,
String? twoFactorEmail,
bool? registrationSuccess,
}) {
return AuthState(
status: status ?? this.status,
@@ -51,6 +54,7 @@ class AuthState {
requiresTwoFactor: requiresTwoFactor ?? this.requiresTwoFactor,
tempToken: tempToken ?? this.tempToken,
twoFactorEmail: twoFactorEmail ?? this.twoFactorEmail,
registrationSuccess: registrationSuccess ?? this.registrationSuccess,
);
}
@@ -182,7 +186,7 @@ class AuthNotifier extends StateNotifier<AuthState> {
final lastName = nameParts.length > 1 ? nameParts.sublist(1).join(' ') : null;
try {
final user = await _repository.register(
await _repository.register(
RegisterRequest(
email: email,
password: password,
@@ -193,13 +197,12 @@ class AuthNotifier extends StateNotifier<AuthState> {
),
);
// Registration successful — user must verify email before logging in
state = state.copyWith(
status: AuthStatus.authenticated,
user: user,
status: AuthStatus.initial,
registeredEmail: email,
registrationSuccess: true,
);
_connectSocket();
_initPushNotifications();
} on ApiException catch (e) {
state = state.copyWith(
status: AuthStatus.error,