refactor: update password reset endpoint documentation and improve scroll behavior in router

This commit is contained in:
zurdi
2025-05-14 15:19:05 +00:00
parent 6e0ea30a55
commit eb4997a189
2 changed files with 11 additions and 8 deletions

View File

@@ -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
"""

View File

@@ -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;