Files
shumai/packages/webui/routes/reset-password.tsx
T
Yiling-J 470a4bd6f7 feat(auth): add admin password reset CLI command and reset password web UI (#347)
* feat(auth): add admin password reset CLI command and reset password web UI

* fix(auth): invalidate previous reset tokens and use AsyncLocalStorage for link capture
2026-08-25 14:35:33 +08:00

19 lines
448 B
TypeScript

import { createFileRoute, redirect } from '@tanstack/react-router'
import { useAuthStore } from '@/ui/stores/auth'
import { z } from 'zod'
const searchSchema = z.object({
token: z.string().catch(''),
})
export const Route = createFileRoute('/reset-password')({
validateSearch: (search) => searchSchema.parse(search),
beforeLoad: () => {
if (useAuthStore.getState().user) {
throw redirect({
to: '/',
})
}
},
})