diff --git a/.env.dev b/.env.dev index 836f648..8a468a9 100644 --- a/.env.dev +++ b/.env.dev @@ -1,3 +1,3 @@ # Dev Environment Configuration -API_BASE_URL=http://144.91.78.96:3001/api/v1 +API_BASE_URL=https://dev.re-quest.com/api/v1 STORAGE_BASE_URL=https://sin1.contabostorage.com/request diff --git a/lib/features/agents/presentation/screens/agent_search_screen.dart b/lib/features/agents/presentation/screens/agent_search_screen.dart index 8538cb2..d175f17 100644 --- a/lib/features/agents/presentation/screens/agent_search_screen.dart +++ b/lib/features/agents/presentation/screens/agent_search_screen.dart @@ -442,7 +442,6 @@ class _AgentCardState extends State<_AgentCard> { color: Color(0xFF638559), borderRadius: BorderRadius.only( bottomLeft: Radius.circular(20), - topRight: Radius.circular(20), ), ), child: Text( diff --git a/lib/features/auth/data/auth_repository.dart b/lib/features/auth/data/auth_repository.dart index 97d1ef8..78939bb 100644 --- a/lib/features/auth/data/auth_repository.dart +++ b/lib/features/auth/data/auth_repository.dart @@ -130,7 +130,9 @@ class AuthRepository { } } - Future register(RegisterRequest request) async { + /// Register returns { message, user } — no tokens. + /// The user must verify their email before logging in. + Future> register(RegisterRequest request) async { try { final response = await _dio.post( ApiConstants.authRegister, @@ -138,14 +140,7 @@ class AuthRepository { ); final data = response.data['data'] as Map; - final authResponse = AuthResponse.fromJson(data); - - await SecureStorage.saveTokens( - accessToken: authResponse.accessToken, - refreshToken: authResponse.refreshToken, - ); - - return authResponse.user; + return data; } on DioException catch (e) { if (e.error is ApiException) { throw e.error as ApiException; diff --git a/lib/features/auth/presentation/providers/auth_provider.dart b/lib/features/auth/presentation/providers/auth_provider.dart index fe3cb14..fa7bdd3 100644 --- a/lib/features/auth/presentation/providers/auth_provider.dart +++ b/lib/features/auth/presentation/providers/auth_provider.dart @@ -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 { 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 { ), ); + // 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, diff --git a/lib/features/auth/presentation/screens/signup_screen.dart b/lib/features/auth/presentation/screens/signup_screen.dart index 8c5c7db..7005c57 100644 --- a/lib/features/auth/presentation/screens/signup_screen.dart +++ b/lib/features/auth/presentation/screens/signup_screen.dart @@ -113,7 +113,7 @@ class _SignupScreenState extends ConsumerState { child: SafeArea( child: SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 24), - child: authState.status == AuthStatus.authenticated + child: authState.registrationSuccess ? _buildSuccessContent(authState) : _buildFormContent(authState), ),