-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
29 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright © 2024 Ory Corp | ||
// SPDX-License-Identifier: Apache-2.0 | ||
"use server" | ||
export { getLoginFlow } from "./login" | ||
|
||
export interface OryPageParams { | ||
searchParams: URLSearchParams | ||
} | ||
export { getLoginFlow } from "./login" | ||
export type { OryPageParams } from "./utils" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
// Copyright © 2024 Ory Corp | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import "@ory/elements-react/theme/styles.css" | ||
import { PropsWithChildren } from "react" | ||
|
||
import "@ory/elements-react/theme/styles.css" | ||
|
||
export default async function AuthLayout({ children }: PropsWithChildren) { | ||
return ( | ||
<> | ||
<main className="p-4 pb-8 flex items-center justify-center flex-col gap-8 min-h-screen"> | ||
{children} | ||
</main> | ||
</> | ||
<main className="p-4 pb-8 flex items-center justify-center flex-col gap-8 min-h-screen"> | ||
{children} | ||
</main> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
// Copyright © 2024 Ory Corp | ||
// SPDX-License-Identifier: Apache-2.0 | ||
"use client" | ||
|
||
export { useRegistrationFlow } from "./registration" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,2 @@ | ||
// Copyright © 2024 Ory Corp | ||
// SPDX-License-Identifier: Apache-2.0 | ||
"use client" | ||
import { FlowType, OnRedirectHandler } from "@ory/client-fetch" | ||
import { useRouter } from "next/router" | ||
import type { ParsedUrlQuery } from "querystring" | ||
import { guessPotentiallyProxiedOrySdkUrl } from "../utils/sdk" | ||
|
||
export const handleRestartFlow = | ||
(searchParams: URLSearchParams, flowType: FlowType) => () => { | ||
window.location.assign( | ||
new URL( | ||
"/self-service/" + | ||
flowType.toString() + | ||
"/browser?" + | ||
searchParams.toString(), | ||
guessPotentiallyProxiedOrySdkUrl(), | ||
).toString(), | ||
) | ||
} | ||
|
||
export function useOnRedirect(): OnRedirectHandler { | ||
const router = useRouter() | ||
return (url: string, external: boolean) => { | ||
if (external) { | ||
window.location.assign(url) | ||
} else { | ||
router.push(url) | ||
} | ||
} | ||
} | ||
|
||
export function toSearchParams(query: ParsedUrlQuery) { | ||
// Convert ParsedUrlQuery to URLSearchParams | ||
const searchParams = new URLSearchParams() | ||
Object.entries(query).forEach(([key, value]) => { | ||
if (!value) { | ||
return | ||
} | ||
|
||
// Handle array | ||
if (Array.isArray(value)) { | ||
value.forEach((v) => searchParams.append(key, v)) | ||
return | ||
} | ||
searchParams.set(key, value) | ||
}) | ||
|
||
return searchParams | ||
} | ||
|
||
export function useSearchParams() { | ||
const router = useRouter() | ||
return toSearchParams(router.query) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters