Skip to content

Commit

Permalink
chore: handle direct navigation to the login and account recovery end…
Browse files Browse the repository at this point in the history
…points
  • Loading branch information
JoblersTune committed Jul 15, 2024
1 parent f91bec9 commit f3175af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions packages/frontend/app/routes/auth.login.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { json, type LoaderFunctionArgs, redirectDocument, } from '@remix-run/node'
import { uuidSchema } from '~/lib/validate.server'
import { isUiNodeInputAttributes } from '@ory/integrations/ui'
import type { UiContainer } from '@ory/client'
Expand Down Expand Up @@ -34,10 +34,9 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
const recoveryUrl = `${variables.kratosBrowserPublicUrl}/self-service/recovery/browser`
return { responseData, recoveryUrl }
} else {
throw json(null, {
status: 400,
statusText: 'No Kratos login flow ID found.'
})
return redirectDocument(
`${variables.kratosBrowserPublicUrl}/self-service/login/browser`
)
}
}

Expand Down
9 changes: 4 additions & 5 deletions packages/frontend/app/routes/auth.recovery.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { json, type LoaderFunctionArgs, redirectDocument } from '@remix-run/node'
import { uuidSchema } from '~/lib/validate.server'
import { isUiNodeInputAttributes } from '@ory/integrations/ui'
import type { UiContainer } from '@ory/client'
Expand Down Expand Up @@ -35,10 +35,9 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {

return { responseData }
} else {
throw json(null, {
status: 400,
statusText: 'No Kratos account recovery flow ID found.'
})
return redirectDocument(
`${variables.kratosBrowserPublicUrl}/self-service/recovery/browser`
)
}
}

Expand Down

0 comments on commit f3175af

Please sign in to comment.