add forgot login

This commit is contained in:
2025-12-05 10:23:22 -03:00
parent b929c492c0
commit 7c3239d856
14 changed files with 270 additions and 57 deletions

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/authorize'
import { redirect } from 'react-router'
import { parse } from 'cookie'
@@ -7,8 +7,8 @@ export async function loader({ request, context }: Route.LoaderArgs) {
const cookies = parse(request.headers.get('Cookie') || '')
const url = new URL(request.url)
const loginUrl = new URL('/', url.origin)
const issuerUrl = new URL('/authorize', context.cloudflare.env.ISSUER_URL)
issuerUrl.search = url.search
const authorizeUrl = new URL('/authorize', context.cloudflare.env.ISSUER_URL)
authorizeUrl.search = url.search
loginUrl.search = url.search
if (!cookies?.SID) {
@@ -19,7 +19,7 @@ export async function loader({ request, context }: Route.LoaderArgs) {
throw redirect(context.cloudflare.env.APP_URL)
}
const r = await fetch(issuerUrl.toString(), {
const r = await fetch(authorizeUrl.toString(), {
method: 'GET',
headers: new Headers([
['Content-Type', 'application/json'],