feat: Implement email verification flow for user registration, update API base URL, and refine agent search screen UI.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user