diff --git a/backend/internal/handler/auth_handler.go b/backend/internal/handler/auth_handler.go index 019b1656..dae3e471 100644 --- a/backend/internal/handler/auth_handler.go +++ b/backend/internal/handler/auth_handler.go @@ -4144,7 +4144,17 @@ func (h *AuthHandler) ProcessPasswordResetToken(c *fiber.Ctx) error { ale.LoginIDs["loginId_normalized"] = loginID userfrontURL := h.resolveUserfrontURL(c) - redirectBase, parseErr := url.Parse(userfrontURL + "/reset-password") + locale := "ko" + acceptLang := c.Get("Accept-Language") + if acceptLang != "" { + // Accept-Language 헤더는 선호도가 가장 높은 순서대로 쉼표로 구분되어 나열됩니다. (예: ko-KR,ko;q=0.9,en-US;q=0.8) + // 따라서 첫 번째 쉼표 이전의 가장 첫 번째 세그먼트가 사용자가 최우선으로 선호하는 언어입니다. + firstLang := strings.Split(acceptLang, ",")[0] + if strings.Contains(strings.ToLower(firstLang), "en") { + locale = "en" + } + } + redirectBase, parseErr := url.Parse(fmt.Sprintf("%s/%s/reset-password", strings.TrimRight(userfrontURL, "/"), locale)) if parseErr != nil { ale.Status = fiber.StatusInternalServerError ale.LatencyMs = time.Since(startTime) diff --git a/userfront/lib/features/auth/presentation/forgot_password_screen.dart b/userfront/lib/features/auth/presentation/forgot_password_screen.dart index 8c01e4cd..9b72a485 100644 --- a/userfront/lib/features/auth/presentation/forgot_password_screen.dart +++ b/userfront/lib/features/auth/presentation/forgot_password_screen.dart @@ -1,4 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import '../../../core/i18n/locale_utils.dart'; +import '../../../core/services/auth_token_store.dart'; import '../../../core/services/auth_proxy_service.dart'; import '../../../core/ui/toast_service.dart'; import 'package:userfront/i18n.dart'; @@ -48,7 +51,17 @@ class _ForgotPasswordScreenState extends State { ); if (mounted) { ToastService.success(tr('msg.userfront.forgot.sent')); - Navigator.of(context).pop(); + if (context.canPop()) { + context.pop(); + } else { + final isLoggedIn = AuthTokenStore.hasToken(); + final localeCode = extractLocaleFromPath(Uri.base) ?? resolvePreferredLocaleCode(); + if (isLoggedIn) { + context.go('/$localeCode/profile'); + } else { + context.go('/$localeCode/signin'); + } + } } } catch (e) { if (mounted) { diff --git a/userfront/lib/features/profile/presentation/pages/profile_page.dart b/userfront/lib/features/profile/presentation/pages/profile_page.dart index 4ed3e63b..d023365c 100644 --- a/userfront/lib/features/profile/presentation/pages/profile_page.dart +++ b/userfront/lib/features/profile/presentation/pages/profile_page.dart @@ -1097,11 +1097,6 @@ class _ProfilePageState extends ConsumerState { ) : Text(tr('ui.userfront.profile.password.change')), ), - const SizedBox(width: 12), - TextButton( - onPressed: () => context.go('/recovery'), - child: Text(tr('ui.userfront.profile.password.forgot')), - ), ], ), ],