mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 22:39:26 +00:00
* 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
19 lines
448 B
TypeScript
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: '/',
|
|
})
|
|
}
|
|
},
|
|
})
|