update forgot password

This commit is contained in:
Phuoc Nguyen
2025-11-10 15:55:22 +07:00
parent 67fd5ed142
commit 453984cd57
4 changed files with 520 additions and 48 deletions

View File

@@ -14,6 +14,7 @@ import 'package:worker/features/account/presentation/pages/change_password_page.
import 'package:worker/features/account/presentation/pages/profile_edit_page.dart';
import 'package:worker/features/auth/domain/entities/business_unit.dart';
import 'package:worker/features/auth/presentation/pages/business_unit_selection_page.dart';
import 'package:worker/features/auth/presentation/pages/forgot_password_page.dart';
import 'package:worker/features/auth/presentation/pages/login_page.dart';
import 'package:worker/features/auth/presentation/pages/otp_verification_page.dart';
import 'package:worker/features/auth/presentation/pages/register_page.dart';
@@ -58,12 +59,13 @@ final routerProvider = Provider<GoRouter>((ref) {
final isLoggedIn = authState.value != null;
final isOnSplashPage = state.matchedLocation == RouteNames.splash;
final isOnLoginPage = state.matchedLocation == RouteNames.login;
final isOnForgotPasswordPage = state.matchedLocation == RouteNames.forgotPassword;
final isOnRegisterPage = state.matchedLocation == RouteNames.register;
final isOnBusinessUnitPage =
state.matchedLocation == RouteNames.businessUnitSelection;
final isOnOtpPage = state.matchedLocation == RouteNames.otpVerification;
final isOnAuthPage =
isOnLoginPage || isOnRegisterPage || isOnBusinessUnitPage || isOnOtpPage;
isOnLoginPage || isOnForgotPasswordPage || isOnRegisterPage || isOnBusinessUnitPage || isOnOtpPage;
// While loading auth state, show splash screen
if (isLoading) {
@@ -106,6 +108,12 @@ final routerProvider = Provider<GoRouter>((ref) {
pageBuilder: (context, state) =>
MaterialPage(key: state.pageKey, child: const LoginPage()),
),
GoRoute(
path: RouteNames.forgotPassword,
name: RouteNames.forgotPassword,
pageBuilder: (context, state) =>
MaterialPage(key: state.pageKey, child: const ForgotPasswordPage()),
),
GoRoute(
path: RouteNames.otpVerification,
name: RouteNames.otpVerification,
@@ -510,6 +518,7 @@ class RouteNames {
// Authentication Routes
static const String splash = '/splash';
static const String login = '/login';
static const String forgotPassword = '/forgot-password';
static const String otpVerification = '/otp-verification';
static const String register = '/register';
static const String businessUnitSelection = '/business-unit-selection';