@@ -32,9 +32,7 @@ class LoginForm extends StatelessWidget {
3232 // For simplicity, we'll put the navigation logic here, but for complex apps,
3333 // you might have a dedicated AuthWrapper or AuthStreamListener at a higher level.
3434 if (supabaseService.currentUser != null &&
35- GoRouter .of (
36- context,
37- ).routerDelegate.currentConfiguration.fullPath !=
35+ GoRouter .of (context).routerDelegate.currentConfiguration.fullPath !=
3836 RoutesPath .dashboard) {
3937 WidgetsBinding .instance.addPostFrameCallback ((_) {
4038 // Check if current route is not already dashboard to prevent loop
@@ -193,15 +191,27 @@ class LoginForm extends StatelessWidget {
193191 onPressed: () async {
194192 // We set loading true, and it will be set to false in the provider's finally block
195193 // The navigation happens after the SupabaseService updates the current user
196- String res = await authProvider.loginUser (
197- email: authProvider.emailController.text,
198- password: authProvider.passwordController.text,
194+ String ? passwordValidationCheck = validatePassword (
195+ authProvider.passwordController.text,
199196 );
200- if (res != "Logged in successfully" ) {
197+ if (passwordValidationCheck == null ) {
198+ String res = await authProvider.loginUser (
199+ email: authProvider.emailController.text,
200+ password: authProvider.passwordController.text,
201+ );
202+ if (res != "Logged in successfully" ) {
203+ ScaffoldMessenger .of (context).showSnackBar (
204+ SnackBar (
205+ content: Text (res),
206+ duration: const Duration (seconds: 5 ),
207+ ),
208+ );
209+ }
210+ } else {
201211 ScaffoldMessenger .of (context).showSnackBar (
202212 SnackBar (
203- content: Text (res ),
204- duration: const Duration (seconds: 5 ),
213+ content: Text (passwordValidationCheck ),
214+ duration: const Duration (seconds: 2 ),
205215 ),
206216 );
207217 }
0 commit comments