From eb4997a18978a0a19026dfdfefcc5985bbd8701a Mon Sep 17 00:00:00 2001 From: zurdi Date: Wed, 14 May 2025 15:19:05 +0000 Subject: [PATCH] refactor: update password reset endpoint documentation and improve scroll behavior in router --- backend/endpoints/auth.py | 5 ++--- frontend/src/plugins/router.ts | 14 +++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/backend/endpoints/auth.py b/backend/endpoints/auth.py index 6c9941761..69e94a64d 100644 --- a/backend/endpoints/auth.py +++ b/backend/endpoints/auth.py @@ -277,11 +277,10 @@ async def auth_openid(request: Request): @router.post("/forgot-password") def request_password_reset(username: str = Body(..., embed=True)) -> MessageResponse: - """Request password reset by email. + """ "Request a password reset link for the user. Args: - email (str): User's email - + username (str): Username of the user requesting the reset Returns: MessageResponse: Confirmation message """ diff --git a/frontend/src/plugins/router.ts b/frontend/src/plugins/router.ts index cc46e278a..c4c0bfd54 100644 --- a/frontend/src/plugins/router.ts +++ b/frontend/src/plugins/router.ts @@ -190,6 +190,15 @@ interface RoutePermissions { const router = createRouter({ history: createWebHistory(process.env.BASE_URL), routes, + scrollBehavior(to, from, savedPosition) { + // If savedPosition is available, it's a popstate navigation (back/forward) + if (savedPosition) { + return savedPosition; + } else { + // Otherwise, scroll to top + return { left: 0, top: 0 }; + } + }, }); const routePermissions: RoutePermissions[] = [ @@ -257,11 +266,6 @@ router.beforeEach(async (to, _from, next) => { } }); -router.afterEach(() => { - // Scroll to top to avoid annoying behaviour on mobile - // window.scrollTo({ top: 0, left: 0 }); -}); - router.beforeResolve(async () => { const viewTransition = startViewTransition(); await viewTransition.captured;