add forgot login
This commit is contained in:
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user