1
0
forked from baron/baron-sso

비밀번호 변경 중간 저장2

This commit is contained in:
2026-01-26 20:29:35 +09:00
parent d922de5df6
commit 739da39a61
19 changed files with 1668 additions and 164 deletions

View File

@@ -10,6 +10,8 @@ import 'features/auth/presentation/login_screen.dart';
import 'features/auth/presentation/signup_screen.dart';
import 'features/auth/presentation/approve_qr_screen.dart';
import 'features/auth/presentation/qr_scan_screen.dart';
import 'features/auth/presentation/forgot_password_screen.dart';
import 'features/auth/presentation/reset_password_screen.dart';
import 'features/dashboard/presentation/dashboard_screen.dart';
import 'features/admin/presentation/user_management_screen.dart';
import 'core/services/auth_proxy_service.dart';
@@ -99,6 +101,23 @@ final _router = GoRouter(
return LoginScreen(verificationToken: token);
},
),
GoRoute(
path: '/forgot-password',
builder: (context, state) {
_routerLogger.info("Navigating to /forgot-password");
return const ForgotPasswordScreen();
},
),
GoRoute(
// Supports both /reset-password and /reset-password?token=...
path: '/reset-password',
builder: (context, state) {
// For deep linking, you might pass the token in the path, e.g., /reset-password/:token
// final token = state.pathParameters['token'];
_routerLogger.info("Navigating to /reset-password");
return const ResetPasswordScreen();
},
),
GoRoute(
path: '/approve',
builder: (context, state) {
@@ -131,26 +150,29 @@ final _router = GoRouter(
final isPublicPath = path == '/login' ||
path == '/signup' ||
path.startsWith('/verify/') ||
path == '/approve';
path == '/approve' ||
path == '/forgot-password' ||
path == '/reset-password';
_routerLogger.fine("Redirect check - Path: $path, IsLoggedIn: $isLoggedIn");
// 0. ALWAYS allow /verify/ to proceed so it can signal the backend
if (path.startsWith('/verify/')) {
// 0. ALWAYS allow public paths to proceed so they can function
if (isPublicPath) {
return null;
}
// If not logged in and trying to access a protected page, redirect to /login
if (!isLoggedIn && !isPublicPath) {
if (!isLoggedIn) {
_routerLogger.info("Not logged in, redirecting to /login");
return '/login';
}
// If logged in and trying to access login page, redirect to root (dashboard)
if (isLoggedIn && path == '/login') {
_routerLogger.info("Logged in, redirecting to /");
return '/';
}
// This is now implicitly handled by the isPublicPath check, but kept for clarity.
// if (isLoggedIn && path == '/login') {
// _routerLogger.info("Logged in, redirecting to /");
// return '/';
// }
return null;
},